Hi,
I’m trying to understand how to consume a Java Web service from a Yii application.
I have a very simple example that gives me "Object of class stdClass could not be converted to int" when is run.
The wsdl for the webservice is the following:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<!--
Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2-hudson-740-.
-->
<!--
Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2-hudson-740-.
-->
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://core.clerp.co/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://core.clerp.co/" name="core">
<types>
<xsd:schema>
<xsd:import namespace="http://core.clerp.co/" schemaLocation="http://localhost:8080/ClerpWS/core?xsd=1"/>
</xsd:schema>
</types>
<message name="add">
<part name="parameters" element="tns:add"/>
</message>
<message name="addResponse">
<part name="parameters" element="tns:addResponse"/>
</message>
<portType name="core">
<operation name="add">
<input wsam:Action="http://core.clerp.co/core/addRequest" message="tns:add"/>
<output wsam:Action="http://core.clerp.co/core/addResponse" message="tns:addResponse"/>
</operation>
</portType>
<binding name="corePortBinding" type="tns:core">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="add">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="core">
<port name="corePort" binding="tns:corePortBinding">
<soap:address location="http://localhost:8080/ClerpWS/core"/>
</port>
</service>
</definitions>
The code that consumes the web service is the following:
public function actionTest() {
$client=new SoapClient('http://localhost:8080/ClerpWS/core?wsdl');
echo 'The sum is ';
$r = (int)$client->add(10,20);
echo ''.$r;
}
I don’t really understand what’s happenning.
Thanks