SoapClient

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
enriquevald
Forum Newbie
Posts: 3
Joined: Tue Feb 16, 2010 11:28 am

SoapClient

Post by enriquevald »

Hi,

I´m trying to consume a web service using:

$this->ns_client->GetDealersByProvince(3);

or

$this->ns_client->__soapCall("GetDealersByProvince", array("province_id"=>"3"));

and when I get the last request by "return $this->ns_client->__getLastRequest();"

I get the resquest is:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Body><ns ... V:Envelope>

The parameter "province_id" is missing.

What is wrong?
User avatar
JNettles
Forum Contributor
Posts: 228
Joined: Mon Oct 05, 2009 4:09 pm

Re: SoapClient

Post by JNettles »

I'm going out on a limb here but 1) you might want to check that your function is actually returning data. 2) Try $this->ns_client->GetDealersByProvinceResult, 3) do a var_dump on $this->ns_client and see what's in your object after everything's been run.

Aside from that I'll need more information on the problem.
enriquevald
Forum Newbie
Posts: 3
Joined: Tue Feb 16, 2010 11:28 am

Re: SoapClient

Post by enriquevald »

The var_dump of $this->ns_client:

object(SoapClient)#2 (3) {
["trace"]=>
int(1)
["_soap_version"]=>
int(1)
["sdl"]=>
resource(4) of type (Unknown)
}


The wsdl:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="GetDealers">
<s:complexType />
</s:element>
<s:element name="GetDealersResponse">
<s:complexType>
<s:sequence>

<s:element minOccurs="0" maxOccurs="1" name="GetDealersResult" type="tns:ArrayOfDealer" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ArrayOfDealer">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="Dealer" nillable="true" type="tns:Dealer" />
</s:sequence>
</s:complexType>

<s:complexType name="Dealer">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Id" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Address" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Locality" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Zip" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="DealerProvince" type="tns:Province" />
<s:element minOccurs="0" maxOccurs="1" name="Responsable" type="s:string" />

<s:element minOccurs="0" maxOccurs="1" name="Email" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Longitude" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Latitude" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Parent" type="s:string" />
</s:sequence>
</s:complexType>
<s:complexType name="Province">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="Id" type="s:int" />

<s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="Order" type="s:int" />
<s:element minOccurs="0" maxOccurs="1" name="ProvCountry" type="tns:Country" />
<s:element minOccurs="0" maxOccurs="1" name="Zip" type="s:string" />
</s:sequence>
</s:complexType>
<s:complexType name="Country">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Id" type="s:string" />

<s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
</s:sequence>
</s:complexType>
<s:element name="GetDealersByProvince">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="province_id" type="s:int" />
</s:sequence>
</s:complexType>

</s:element>
<s:element name="GetDealersByProvinceResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetDealersByProvinceResult" type="tns:ArrayOfDealer" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>

</wsdl:types>
<wsdl:message name="GetDealersSoapIn">
<wsdl:part name="parameters" element="tns:GetDealers" />
</wsdl:message>
<wsdl:message name="GetDealersSoapOut">
<wsdl:part name="parameters" element="tns:GetDealersResponse" />
</wsdl:message>
<wsdl:message name="GetDealersByProvinceSoapIn">
<wsdl:part name="parameters" element="tns:GetDealersByProvince" />

</wsdl:message>
<wsdl:message name="GetDealersByProvinceSoapOut">
<wsdl:part name="parameters" element="tns:GetDealersByProvinceResponse" />
</wsdl:message>
<wsdl:portType name="nissan_servicesSoap">
<wsdl:operation name="GetDealers">
<wsdl:input message="tns:GetDealersSoapIn" />
<wsdl:output message="tns:GetDealersSoapOut" />
</wsdl:operation>

<wsdl:operation name="GetDealersByProvince">
<wsdl:input message="tns:GetDealersByProvinceSoapIn" />
<wsdl:output message="tns:GetDealersByProvinceSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="nissan_servicesSoap" type="tns:nissan_servicesSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetDealers">
<soap:operation soapAction="http://tempuri.org/GetDealers" style="document" />

<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetDealersByProvince">
<soap:operation soapAction="http://tempuri.org/GetDealersByProvince" 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="nissan_servicesSoap12" type="tns:nissan_servicesSoap">

<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetDealers">
<soap12:operation soapAction="http://tempuri.org/GetDealers" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>

</wsdl:operation>
<wsdl:operation name="GetDealersByProvince">
<soap12:operation soapAction="http://tempuri.org/GetDealersByProvince" 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="nissan_services">
<wsdl:port name="nissan_servicesSoap" binding="tns:nissan_servicesSoap">
<soap:address location="http://localhost:1643/nissan_services.asmx" />
</wsdl:port>
<wsdl:port name="nissan_servicesSoap12" binding="tns:nissan_servicesSoap12">
<soap12:address location="http://localhost:1643/nissan_services.asmx" />
</wsdl:port>

</wsdl:service>
</wsdl:definitions>
User avatar
JNettles
Forum Contributor
Posts: 228
Joined: Mon Oct 05, 2009 4:09 pm

Re: SoapClient

Post by JNettles »

Doesn't look like you're actually returning anything from the service. Is this a public web service? If it is, post the wsdl link here and I'll give it a shot in my spare time. If not, my best advice is to just keep plugging at it until you get results returned (keep a print_r going on your soap client).
enriquevald
Forum Newbie
Posts: 3
Joined: Tue Feb 16, 2010 11:28 am

Re: SoapClient

Post by enriquevald »

Hi,

The WSDL url:

http://nissan-qashqai-web01.housings.ne ... .asmx?WSDL

I consume this web services in ASP.NET app and is working fine.

Any idea?
Post Reply