1

I'm using PHP 5.5.9 Soap to access a web service and using a WSSoapClient (noted from here: how to implement ws-security 1.1 in php5) to help with the security. Not sure I can share the WSDL at this time. I'm getting a null response value when I call a function, but the __getLastResponse value has the XML data showing all the expected fields I see in SoapUI.

There are two functions defined in the WSDL that I'm calling, though I'm only seeing the issue with one. They both take the same arguments and I just copied the script and changed the function names to compare results, so I know there aren't typos, etc.

Function that works (Identity):

$params = array("IdentityRequest" => array("IdentityPersonRequest" => array("IdentityID" => $userid,"InterfaceID" => $interfaceID)));
$response = $client->__call('Identity',$params);

Function that doesn't work (IdentityInterface):

$params = array("IdentityInterfaceRequest" => array("IdentityPersonRequest" => array("IdentityID" => $userid,"InterfaceID" => $interfaceID)));
$response = $client->__call('IdentityInterface',$params);

When I use var_dump I get the expected object for the 'Identity' function output. When I use it for 'IdentityInterface' I get a NULL return. The __getLastResponse() output shows the XML as I'd expect it in both cases.

Identity Response:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
        <SOAP-ENV:Body>
            <ns5:IdentityResponse xmlns:ns5="http://company-url-stuff/it/contract/IdentityService/v1" xmlns:ns2="http://company-url-stuff/it/msg/v1" xmlns:ns3="http://company-url-stuff/it/data/v1" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns="">
                <ns5:IdentityCompositeInformation>
                    <ns3:IdentityPersonResponse>
                        <ns3:IdentityPersonType>
                            <ns3:PersonInformation>
                                <ns3:Name>Jones, Joe J.</ns3:Name>
                                <ns3:SalutationPreferredName> </ns3:SalutationPreferredName>
                                <ns3:GivenName>Joe </ns3:GivenName>
                                <ns3:MiddleName>J.</ns3:MiddleName>
                                <ns3:FamilyName>Jones</ns3:FamilyName>
                            </ns3:PersonInformation>
                            <ns3:PersonBusinessInformation>
                                <ns3:IdentityID>000000</ns3:IdentityID>
                                <ns3:PersonAccount>
                                    <ns3:NTID>jjones</ns3:NTID>
                                </ns3:PersonAccount>
                                <ns3:PersonFinance>
                                    <ns3:BusinessUnitName>Management</ns3:BusinessUnitName>
                                </ns3:PersonFinance>
                            </ns3:PersonBusinessInformation>
                        </ns3:IdentityPersonType>
                        <ns3:IdentityType>
                            <ns3:IdentityType>E</ns3:IdentityType>
                        </ns3:IdentityType>
                    </ns3:IdentityPersonResponse>
                <ns3:IdentityEntitlementResponse/>
            </ns5:IdentityCompositeInformation>
        </ns5:IdentityResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

IdentityInterface Response:

<SOAP-ENV:Envelope
   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
        <SOAP-ENV:Header/>
            <SOAP-ENV:Body>
                <ns5:IdentityResponse xmlns:ns5="http://company-url-stuff/it/contract/IdentityService/v1" xmlns:ns2="http://company-url-stuff/it/msg/v1"
   xmlns:ns3="http://company-url-stuff/it/data/v1"
   xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns="">
                    <ns5:IdentityCompositeInformation>
                        <ns3:IdentityPersonResponse>
                            <ns3:IdentityPersonType>
                                <ns3:PersonInformation>
                                    <ns3:GivenName>Joe</ns3:GivenName>
                                    <ns3:MiddleName>J.</ns3:MiddleName>
                                    <ns3:FamilyName>Jones</ns3:FamilyName>
                                </ns3:PersonInformation>
                                <ns3:PersonBusinessInformation>
                                    <ns3:IdentityID>000000</ns3:IdentityID>
                                    <ns3:PersonAccount>
                                        <ns3:NTID>jjones</ns3:NTID></ns3:PersonAccount>
                                    <ns3:PersonPosition>
                                        <ns3:JobCode>123456</ns3:JobCode>
                                        <ns3:JobTitle>Manager</ns3:JobTitle>
                                        <ns3:FullPartTime>F</ns3:FullPartTime>
                                        <ns3:MgrLevelDesc>Manager</ns3:MgrLevelDesc>
                                        <ns3:EmpReports>N</ns3:EmpReports>
                                        <ns3:ReportingManager>
                                            <ns3:ID>456798</ns3:ID>
                                        </ns3:ReportingManager>
                                    </ns3:PersonPosition>
                                    <ns3:PersonFinance>
                                        <ns3:DeptID>ID1234</ns3:DeptID>
                                        <ns3:DeptName>Dispatch</ns3:DeptName>
                                        <ns3:CompanyCode>US1</ns3:CompanyCode>
                                        <ns3:CostCenter>US10CC</ns3:CostCenter>
                                        <ns3:CountryCode>US</ns3:CountryCode>
                                    </ns3:PersonFinance>
                                    <ns3:PersonContact>
                                        <ns3:EmailAddress>[email protected]</ns3:EmailAddress>
                                        <ns3:PersonLocation>
                                            <ns3:Region>NAMERICA</ns3:Region>
                                            <ns3:AddressInfo>
                                                <ns3:City>New York</ns3:City>
                                                <ns3:County> </ns3:County>
                                                <ns3:Province>NY</ns3:Province>
                                                <ns3:CountryName>US</ns3:CountryName>
                                                <ns3:Description>BUSINESS_ADDRESS</ns3:Description>
                                            </ns3:AddressInfo>
                                        </ns3:PersonLocation>
                                    </ns3:PersonContact>
                                </ns3:PersonBusinessInformation>
                            </ns3:IdentityPersonType>
                            <ns3:IdentityType>
                                <ns3:IdentityType>E</ns3:IdentityType>
                            </ns3:IdentityType>
                        </ns3:IdentityPersonResponse>
                    <ns3:IdentityEntitlementResponse/>
                </ns5:IdentityCompositeInformation>
            </ns5:IdentityResponse>
        </SOAP-ENV:Body>
       </SOAP-ENV:Envelope>

I'd seen some references that the WSDL may not be returning properly formatted XML, but don't see those types of errors when testing it in SoapUI. If I can't upload the WSDL, what would I need to look for to determine why this is happening.

UPDATED with WSDL info:

 <xsd:element name="IdentityInterfaceResponse" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <xsd:complexType xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <xsd:sequence xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <xsd:element maxOccurs="unbounded" minOccurs="0" name="IdentityCompositeInformation" type="data:IdentityCompositeInformationType" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
     </xsd:sequence>
   </xsd:complexType>
 </xsd:element>
<message name="IdentityInterfaceResponse">
  <part name="IdentityInterfaceResponse" element="sch0:IdentityInterfaceResponse"/>
</message>
<message name="IdentityInterfaceRequest">
  <part name="IdentityInterfaceRequest" element="sch0:IdentityInterfaceRequest"/>
</message>
<message name="IdentityResponse">
  <part name="IdentityResponse" element="sch0:IdentityResponse"/>
</message>
<message name="IdentityImageRequest">
  <part name="IdentityImageRequest" element="sch0:IdentityImageRequest"/>
</message>
<message name="IdentityRequest">
  <part name="IdentityRequest" element="sch0:IdentityRequest"/>
</message>
<message name="IdentityImageResponse">
  <part name="IdentityImageResponse" element="sch0:IdentityImageResponse"/>
</message>
<portType name="IdentityService">
  <operation name="IdentityInterface">
    <input name="IdentityInterfaceRequest" message="sch0:IdentityInterfaceRequest"/>
    <output name="IdentityInterfaceResponse" message="sch0:IdentityInterfaceResponse"/>
  </operation>
  <operation name="Identity">
    <input name="IdentityRequest" message="sch0:IdentityRequest"/>
    <output name="IdentityResponse" message="sch0:IdentityResponse"/>
  </operation>
  <operation name="IdentityImage">
    <input name="IdentityImageRequest" message="sch0:IdentityImageRequest"/>
    <output name="IdentityImageResponse" message="sch0:IdentityImageResponse"/>
  </operation>
</portType>
<binding name="IdentityServiceSoap11" type="sch0:IdentityService">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
  <operation name="IdentityInterface">
    <soap:operation soapAction=""/>
    <input name="IdentityInterfaceRequest">
      <soap:body use="literal"/>
  <wsp:PolicyReference xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" URI="#IdentityInterface_input_policy"/>
    </input>
    <output name="IdentityInterfaceResponse">
      <soap:body use="literal"/>
    </output>
  </operation>
  <operation name="Identity">
    <soap:operation soapAction=""/>
    <input name="IdentityRequest">
      <soap:body use="literal"/>
  <wsp:PolicyReference xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" URI="#Identity_input_policy"/>
    </input>
    <output name="IdentityResponse">
      <soap:body use="literal"/>
    </output>
  </operation>
  <operation name="IdentityImage">
    <soap:operation soapAction=""/>
    <input name="IdentityImageRequest">
      <soap:body use="literal"/>
  <wsp:PolicyReference xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" URI="#IdentityImage_input_policy"/>
    </input>
    <output name="IdentityImageResponse">
      <soap:body use="literal"/>
    </output>
  </operation>
</binding>

Thank you in advance.

9
  • For more pointers you could show the response XML(s). If those contain secret information, redact those parts. For the WSDL check if it's got a public URI, then you could share the URI (and not the WSDL document itself). Commented Jul 30, 2014 at 11:42
  • Still working on this, but I believe that the issue is that the response is not properly formatted. After looking at the WSDL in Eclipse, I noted that the IdentityInterface function looks to be expecting an output in the form of an "IdentityInterfaceResponse". However, as you can see from the above getLastReponse output, the query is returning an IdentityResponse. Pretty sure this is it, but still checking. Commented Aug 19, 2014 at 14:18
  • that must not be an issue. If IdentityResponse is a IdentityInterfaceResponse (or implements it), this would be fine (and an option just by the names). So check the WSDL for subclasses/subtypes, too. Commented Aug 22, 2014 at 17:18
  • Added some of the WSDL elements - are these the sections to look for? Sorry, not WSDL savvy. Can you override the expected return format? The WSDL can't be changed. Commented Aug 25, 2014 at 19:38
  • @hakre - I was looking at this post: Stackoverflow - SoapClient Returns “NULL”, but __getLastResponse() returns XML and it seemed to be the same issue. I can't tell, however, what changed to make that work. How can I tell PHP to not worry about the response output type? Do I have to simply grab the response headers and parse them as XML? Thanks! Commented Aug 27, 2014 at 15:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.