...

View Full Version : SOAP parameter



Ty44ler
06-21-2010, 05:54 PM
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.



$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:

<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?

Ty44ler
06-22-2010, 02:45 PM
I hate to be a beggar on here, but I'm in big need of some help! Thank you!

Fou-Lu
06-22-2010, 05:26 PM
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).

Ty44ler
06-22-2010, 06:08 PM
Got it figured out:

$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 />";

Fou-Lu
06-22-2010, 06:52 PM
Ah, it wanted an array for its parameter. Good thing __soapCall is an overridden function chain eh? Otherwise you'd have this:


$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?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum