Hi,
I'm having a problem with PB9 when I try call a webservice in the JBOSS.
I'm getting this response:
Unexpected wrapper element soma found. Expected {
http://services.twcom.com.br/}soma.
This is a test, if I can call the webservice, we will move on to the next step and the real webservice.
I looked in the Envelope generated and comparing with the Envelope from a Java program, they have slightly differences, and I don't know if those differences are problem.
Below I posted my PB code, the webservice's WSDL, and the Envelopes from Java and PB.
I'd appreciate any help. And sorry or any mistake, this is my first post here :D
** This is my code in PB:
-------------------------------------------------------
long l_ret
SoapConnection conn
twcomcalculadorawsport p_obj
tns__soma arg_soma
tns__somaresponse arg_soma_response
//Create connection instance
conn = create SoapConnection
//Set options for the connection
conn.SetOptions("SoapLog=~"c:\\soaplog.txt~"")
// Create proxy instance
l_ret = Conn.CreateInstance(p_obj, "twcomcalculadorawsport")
if l_ret <> 0 then
MessageBox("Error", "Cannot create instance of proxy")
return
end if
// Invoke Web Service
try
arg_soma.numero1 = 1
arg_soma.numero2 = 2
arg_soma_response = p_obj.Soma(arg_soma)
MessageBox("Soma","Soma = "+ string(arg_soma_response.ws_return))
catch ( SoapException e )
MessageBox ("Error", "Cannot invoke Web Service~n" +e.getMessage())
end try
destroy conn
-------------------------------------------------------
** This is my WSDL:
-------------------------------------------------------
<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name="CalculadoraWS" targetNamespace="
http://services.twcom.com.br/" xmlns:ns1="
http://schemas.xmlsoap.org/soap/http" xmlns:soap="
http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="
http://services.twcom.com.br/" xmlns:wsdl="
http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xs:schema elementFormDefault="unqualified" targetNamespace="
http://services.twcom.com.br/" version="1.0" xmlns:tns="
http://services.twcom.com.br/" xmlns:xs="
http://www.w3.org/2001/XMLSchema">
<xs:element name="soma" type="tns:soma"/>
<xs:element name="somaResponse" type="tns:somaResponse"/>
<xs:element name="subtracao" type="tns:subtracao"/>
<xs:element name="subtracaoResponse" type="tns:subtracaoResponse"/>
<xs:complexType name="subtracao">
<xs:sequence>
<xs:element minOccurs="0" name="numero1" type="xs:int"/>
<xs:element minOccurs="0" name="numero2" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="subtracaoResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="soma">
<xs:sequence>
<xs:element minOccurs="0" name="numero1" type="xs:int"/>
<xs:element minOccurs="0" name="numero2" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="somaResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="somaResponse">
<wsdl:part element="tns:somaResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="soma">
<wsdl:part element="tns:soma" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="subtracao">
<wsdl:part element="tns:subtracao" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="subtracaoResponse">
<wsdl:part element="tns:subtracaoResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="CalculadoraWS">
<wsdl:operation name="subtracao">
<wsdl:input message="tns:subtracao" name="subtracao">
</wsdl:input>
<wsdl:output message="tns:subtracaoResponse" name="subtracaoResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="soma">
<wsdl:input message="tns:soma" name="soma">
</wsdl:input>
<wsdl:output message="tns:somaResponse" name="somaResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CalculadoraWSSoapBinding" type="tns:CalculadoraWS">
<soap:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="subtracao">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="subtracao">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="subtracaoResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="soma">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="soma">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="somaResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CalculadoraWS">
<wsdl:port binding="tns:CalculadoraWSSoapBinding" name="CalculadoraWSPort">
<soap:address location="
http://PC-1:8080/TesteWS/CalculadoraWS"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
-------------------------------------------------------
** This is the Envelope from Java:
-------------------------------------------------------
<v:Envelope
xmlns:i="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:d="
http://www.w3.org/2001/XMLSchema"
xmlns:c="
http://schemas.xmlsoap.org/soap/encoding/"
xmlns:v="
http://schemas.xmlsoap.org/soap/envelope/">
<v:Header />
<v:Body>
<n0:soma id="o0" c:root="1" xmlns:n0="
http://services.twcom.com.br/">
<numero1 i:type="d:string">1</numero1>
<numero2 i:type="d:string">2</numero2>
</n0:soma>
</v:Body>
</v:Envelope>
-------------------------------------------------------
** This is the Envelope from PB:
-------------------------------------------------------
<E:Envelope
xmlns:E="
http://schemas.xmlsoap.org/soap/envelope/"
xmlns:A="
http://schemas.xmlsoap.org/soap/encoding/"
xmlns:s="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:y="
http://www.w3.org/2001/XMLSchema"
E:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/">
<E:Body>
<soma s:type="ns1:soma" xmlns:ns1="
http://services.twcom.com.br/">
<ns1:numero1 s:type="y:int">1</ns1:numero1>
<ns1:numero2 s:type="y:int">2</ns1:numero2>
</soma>
</E:Body>
</E:Envelope>
-------------------------------------------------------