Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: SOAP parameter

  1. #1
    New Coder
    Join Date
    Feb 2008
    Posts
    57
    Thanks
    8
    Thanked 0 Times in 0 Posts

    SOAP parameter

    I'm just trying to make a SOAP call that passes one parameter (customerNumber) and prints a dropdown box, but nothing is showing up in the dropdown box.


    PHP Code:
    $client = new SoapClient("http://refrigerantcompliance/RefrigerantComplianceService/Service1.asmx?wsdl", array('cache_wsdl' => 0));
    $result $client->GetWorkOrders("31200");

    print 
    "<select name='workorder'><option>Please Select One</option>";
        foreach(
    $result as $k=>$v){
            print 
    "<option value=\"".$v->SRPWOHRID."\">".$v->SRPWOHRID." - ".$v->Description."</option>";
          }
    print 
    "</select><br />"
    WSDL File:
    Code:
    <wsdl:definitions targetNamespace="http://tempuri.org/">
    −
    <wsdl:types>
    −
    <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
    −
    <s:element name="HelloWorld">
    <s:complexType/>
    </s:element>
    −
    <s:element name="HelloWorldResponse">
    −
    <s:complexType>
    −
    <s:sequence>
    <s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string"/>
    </s:sequence>
    </s:complexType>
    </s:element>
    −
    <s:element name="GetJobs">
    <s:complexType/>
    </s:element>
    −
    <s:element name="GetJobsResponse">
    −
    <s:complexType>
    −
    <s:sequence>
    <s:element minOccurs="0" maxOccurs="1" name="GetJobsResult" type="tns:ArrayOfJobDAO"/>
    </s:sequence>
    </s:complexType>
    </s:element>
    −
    <s:complexType name="ArrayOfJobDAO">
    −
    <s:sequence>
    <s:element minOccurs="0" maxOccurs="unbounded" name="JobDAO" nillable="true" type="tns:JobDAO"/>
    </s:sequence>
    </s:complexType>
    −
    <s:complexType name="JobDAO">
    −
    <s:sequence>
    <s:element minOccurs="0" maxOccurs="1" name="StatusCode" type="s:string"/>
    <s:element minOccurs="1" maxOccurs="1" name="SRPWOHRID" type="s:int"/>
    <s:element minOccurs="1" maxOccurs="1" name="CompanyNumber" type="s:int"/>
    <s:element minOccurs="1" maxOccurs="1" name="DivisionNumber" type="s:int"/>
    <s:element minOccurs="1" maxOccurs="1" name="CustomerNumber" type="s:int"/>
    <s:element minOccurs="1" maxOccurs="1" name="RequestNo" type="s:int"/>
    <s:element minOccurs="0" maxOccurs="1" name="RequestorName" type="s:string"/>
    <s:element minOccurs="0" maxOccurs="1" name="AreaCode" type="s:string"/>
    <s:element minOccurs="0" maxOccurs="1" name="PhoneNo" type="s:string"/>
    <s:element minOccurs="0" maxOccurs="1" name="Address1" type="s:string"/>
    <s:element minOccurs="0" maxOccurs="1" name="Address2" type="s:string"/>
    <s:element minOccurs="0" maxOccurs="1" name="City" type="s:string"/>
    <s:element minOccurs="0" maxOccurs="1" name="StateCode" type="s:string"/>
    <s:element minOccurs="0" maxOccurs="1" name="ZipCode" type="s:string"/>
    <s:element minOccurs="0" maxOccurs="1" name="RequestType" type="s:string"/>
    <s:element minOccurs="0" maxOccurs="1" name="CustomerPONumber" type="s:string"/>
    <s:element minOccurs="0" maxOccurs="1" name="Description" type="s:string"/>
    </s:sequence>
    </s:complexType>
    </s:schema>
    </wsdl:types>
    −
    <wsdl:message name="HelloWorldSoapIn">
    <wsdl:part name="parameters" element="tns:HelloWorld"/>
    </wsdl:message>
    −
    <wsdl:message name="HelloWorldSoapOut">
    <wsdl:part name="parameters" element="tns:HelloWorldResponse"/>
    </wsdl:message>
    −
    <wsdl:message name="GetJobsSoapIn">
    <wsdl:part name="parameters" element="tns:GetJobs"/>
    </wsdl:message>
    −
    <wsdl:message name="GetJobsSoapOut">
    <wsdl:part name="parameters" element="tns:GetJobsResponse"/>
    </wsdl:message>
    −
    <wsdl:portType name="Service1Soap">
    −
    <wsdl:operation name="HelloWorld">
    <wsdl:input message="tns:HelloWorldSoapIn"/>
    <wsdl:output message="tns:HelloWorldSoapOut"/>
    </wsdl:operation>
    −
    <wsdl:operation name="GetJobs">
    <wsdl:input message="tns:GetJobsSoapIn"/>
    <wsdl:output message="tns:GetJobsSoapOut"/>
    </wsdl:operation>
    </wsdl:portType>
    −
    <wsdl:binding name="Service1Soap" type="tns:Service1Soap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    −
    <wsdl:operation name="HelloWorld">
    <soap:operation soapAction="http://tempuri.org/HelloWorld" style="document"/>
    −
    <wsdl:input>
    <soap:body use="literal"/>
    </wsdl:input>
    −
    <wsdl:output>
    <soap:body use="literal"/>
    </wsdl:output>
    </wsdl:operation>
    −
    <wsdl:operation name="GetJobs">
    <soap:operation soapAction="http://tempuri.org/GetJobs" style="document"/>
    −
    <wsdl:input>
    <soap:body use="literal"/>
    </wsdl:input>
    −
    <wsdl:output>
    <soap:body use="literal"/>
    </wsdl:output>
    </wsdl:operation>
    </wsdl:binding>
    −
    <wsdl:binding name="Service1Soap12" type="tns:Service1Soap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    −
    <wsdl:operation name="HelloWorld">
    <soap12:operation soapAction="http://tempuri.org/HelloWorld" style="document"/>
    −
    <wsdl:input>
    <soap12:body use="literal"/>
    </wsdl:input>
    −
    <wsdl:output>
    <soap12:body use="literal"/>
    </wsdl:output>
    </wsdl:operation>
    −
    <wsdl:operation name="GetJobs">
    <soap12:operation soapAction="http://tempuri.org/GetJobs" style="document"/>
    −
    <wsdl:input>
    <soap12:body use="literal"/>
    </wsdl:input>
    −
    <wsdl:output>
    <soap12:body use="literal"/>
    </wsdl:output>
    </wsdl:operation>
    </wsdl:binding>
    −
    <wsdl:service name="Service1">
    −
    <wsdl:port name="Service1Soap" binding="tns:Service1Soap">
    <soap:address location="http://sqlsvr1/RefrigerantComplianceService/Service1.asmx"/>
    </wsdl:port>
    −
    <wsdl:port name="Service1Soap12" binding="tns:Service1Soap12">
    <soap12:address location="http://sqlsvr1/RefrigerantComplianceService/Service1.asmx"/>
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>

    var_dump($result); resulted in:
    object(stdClass)#1 (1) {
    ["GetWorkOrdersResult"]=>
    object(stdClass)#3 (0) {
    }
    }


    Does anyone know what I'm doing wrong?
    Last edited by Ty44ler; 06-22-2010 at 01:41 PM.

  • #2
    New Coder
    Join Date
    Feb 2008
    Posts
    57
    Thanks
    8
    Thanked 0 Times in 0 Posts
    I hate to be a beggar on here, but I'm in big need of some help! Thank you!

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    I don't think that this wsdl corresponds to what you are executing. This is missing the GetWorkOrders operation in it. I noticed that you have a bind to http://sqlsvr1, but your client is seeking http://refrigerantcompliance. This doesn't necessarily mean that these are not the same, but given the missing operation, I'd say that this is the case.

    Clearly you are getting a response of some sorts though. So I'd say that the issue lies either in the return result of the GetWorkOrders function, or the data provided for it (31200).
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #4
    New Coder
    Join Date
    Feb 2008
    Posts
    57
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Got it figured out:
    Code:
    $client = new SoapClient("http://refrigerantcompliance/RefrigerantComplianceService/Service1.asmx?wsdl", array('cache_wsdl' => 0, 'trace' => 1));
    $result = $client->GetWorkOrders(array("customerNumber" => "31150"));
    $orders = $result->GetWorkOrdersResult->WorkOrderDAO;
    
    print "<select name='workorder'><option>Please Select One</option>";
        foreach($orders as $k=>$v){
            print "<option value=\"".$v->SRPWOHRID."\">".$v->SRPWOHRID." - ".$v->Description."</option>";
          }
    print "</select><br />";

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Ah, it wanted an array for its parameter. Good thing __soapCall is an overridden function chain eh? Otherwise you'd have this:
    PHP Code:
    $client->__soapCall('GetWorkOrders', array(array('customerNumber' => 31150))); 
    o.O
    Wierd lol.

    Glad you got it working though. Can you confirm that the wsdl files do not correspond?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •