Hi All,
I'm trying to test create a soap clienet in PHP, here's my code:
<?php
$client = new SoapClient("
http://10.132.32.112:8080/axis2/services/TemperatureConverter?wsdl",
array('exceptions' => 0));
try {
$a = 32;
$result = $client->__soapCall("c2FConvertion",array($a));
#c2FConvertion("a");
print_r($result);
} catch (SoapFault $result) {
print_r($result);
}
?>
When I run this to invoke the service, I got this error:
SoapFault Object
(
[message:protected] => Exception occurred while trying to invoke service
method c2fConvertion
[string:private] =>
[code:protected] => 0
[file:protected] => /home/chino/Tests/soapclienet/GetTemp.php
[line:protected] => 5
[trace:private] => Array
(
[0] => Array
(
[file] => /home/chino/Tests/soapclienet/GetTemp.php
[line] => 5
[function] => __soapCall
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] => c2FConvertion
[1] => Array
(
[0] => 32
)
)
)
)
[faultstring] => Exception occurred while trying to invoke service
method c2fConvertion
[faultcode] => soapenv:Client
[detail] =>
)
My Web Service basically does temperature convertion and is writting in java
using axis2. my java client can invoke
this service remotely. Here's the WSDL file:
<wsdl:definitions targetNamespace="http://example.ws">
<wsdl:documentation>TemperatureConverter</wsdl:documentation>
<wsdl:types>
<xs:schema attributeFormDefault="qualified"
elementFormDefault="qualified" targetNamespace="http://example.ws/xsd">
<xs:element name="c2fConvertion">
<xs:complexType>
<xs:sequence>
<xs:element name="cValue" nillable="true" type="xs:double"/>
</xs:sequence>
</xs:complexType>
</xs:element>
−
<xs:element name="c2fConvertionResponse">
−
<xs:complexType>
−
<xs:sequence>
<xs:element name="return" nillable="true" type="xs:double"/>
</xs:sequence>
</xs:complexType>
</xs:element>
−
<xs:element name="f2cConvertion">
−
<xs:complexType>
−
<xs:sequence>
<xs:element name="fValue" nillable="true" type="xs:double"/>
</xs:sequence>
</xs:complexType>
</xs:element>
−
<xs:element name="f2cConvertionResponse">
−
<xs:complexType>
−
<xs:sequence>
<xs:element name="return" nillable="true" type="xs:double"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
−
<wsdl:message name="f2cConvertionMessage">
<wsdl:part name="part1" element="ns0:f2cConvertion"/>
</wsdl:message>
−
<wsdl:message name="f2cConvertionResponse">
<wsdl:part name="part1" element="ns0:f2cConvertionResponse"/>
</wsdl:message>
−
<wsdl:message name="c2fConvertionMessage">
<wsdl:part name="part1" element="ns0:c2fConvertion"/>
</wsdl:message>
−
<wsdl:message name="c2fConvertionResponse">
<wsdl:part name="part1" element="ns0:c2fConvertionResponse"/>
</wsdl:message>
−
<wsdl:portType name="TemperatureConverterPortType">
−
<wsdl:operation name="f2cConvertion">
<wsdl:input message="axis2:f2cConvertionMessage"
wsaw:Action="urn:f2cConvertion"/>
<wsdl:output message="axis2:f2cConvertionResponse"/>
</wsdl:operation>
−
<wsdl:operation name="c2fConvertion">
<wsdl:input message="axis2:c2fConvertionMessage"
wsaw:Action="urn:c2fConvertion"/>
<wsdl:output message="axis2:c2fConvertionResponse"/>
</wsdl:operation>
</wsdl:portType>
−
<wsdl:binding name="TemperatureConverterSOAP11Binding"
type="axis2:TemperatureConverterPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
−
<wsdl:operation name="f2cConvertion">
<soap:operation soapAction="urn:f2cConvertion" style="document"/>
−
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
−
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
−
<wsdl:operation name="c2fConvertion">
<soap:operation soapAction="urn:c2fConvertion" 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="TemperatureConverterSOAP12Binding"
type="axis2:TemperatureConverterPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
−
<wsdl:operation name="f2cConvertion">
<soap12:operation soapAction="urn:f2cConvertion" style="document"/>
−
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
−
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
−
<wsdl:operation name="c2fConvertion">
<soap12:operation soapAction="urn:c2fConvertion" style="document"/>
−
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
−
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
−
<wsdl:binding name="TemperatureConverterHttpBinding"
type="axis2:TemperatureConverterPortType">
<http:binding verb="POST"/>
−
<wsdl:operation name="f2cConvertion">
<http:operation location="f2cConvertion"/>
−
<wsdl:input>
<mime:content type="text/xml"/>
</wsdl:input>
−
<wsdl:output>
<mime:content type="text/xml"/>
</wsdl:output>
</wsdl:operation>
−
<wsdl:operation name="c2fConvertion">
<http:operation location="c2fConvertion"/>
−
<wsdl:input>
<mime:content type="text/xml"/>
</wsdl:input>
−
<wsdl:output>
<mime:content type="text/xml"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
−
<wsdl:service name="TemperatureConverter">
−
<wsdl:port name="TemperatureConverterSOAP11port_http"
binding="axis2:TemperatureConverterSOAP11Binding">
<soap:address location="
http://10.132.32.112:8080/axis2/services/TemperatureConverter"/>
</wsdl:port>
−
<wsdl:port name="TemperatureConverterSOAP12port_http"
binding="axis2:TemperatureConverterSOAP12Binding">
<soap12:address location="
http://10.132.32.112:8080/axis2/services/TemperatureConverter"/>
</wsdl:port>
−
<wsdl:port name="TemperatureConverterHttpport"
binding="axis2:TemperatureConverterHttpBinding">
<http:address location="
http://10.132.32.112:8080/axis2/services/TemperatureConverter"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Hoping for any advise. :)
Thanks in advance.
Chino