Hi all,
I am in the process of testing PB's ability to consume an existing web service. I have done some reading left and right.
I can create the proxy , but i always end up having the Cannot invoke webservice messagebox.
Here's my little piece of PB code
PB CODE START
soapconnection conn // Define SoapConnection
checkvatport proxy_obj // Declare proxy
long rVal, lLog
real amount
date date_a
string ls_a,ls_b,ls_c
conn = create soapconnection //Instantiated connection
lLog = conn.SetSoapLogFile ("C:\mySoapLog.log")
rVal = Conn.CreateInstance(proxy_obj, "checkvatport", "")
messagebox("test rval",string(rval))
// Create proxy object
try
date_a = today()
boolean w_t
w_t = TRUE
str_checkvat str1
tns1__checkvatresponse str2
str1.countrycode = "BE"
str1.vatnumber = "0810416786"
ls_a = proxy_obj.checkvat(str1.countryCode,str1.vatNumber,str2.requestdate,str2.valid,str2.address)
messagebox("LS-a",ls_a)
catch ( SoapException e )
messagebox ("Error", "Cannot invoke Web service")
// error handling
end try
destroy conn
PB CODE END
And here's the soaplog contents
SOAPLOG START
CLOSED
REQUEST:
CLOSED
POST /taxation_customs/vies/services/checkVatService HTTP/1.1
Host: ec.europa.eu
Connection: Keep-Alive
User-Agent: EasySoap++/0.6
Content-Type: text/xml; charset=utf-8
SOAPAction: "urn:ec.europa.eu:taxud:vies:services:checkVat#checkVat"
Content-Length: 654
<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>
<m:checkVat
xmlns:m="urn:ec.europa.eu:taxud:vies:services:checkVat:types">
<ns1:countryCode
xmlns:ns1="urn:ec.europa.eu:taxud:vies:services:checkVat"
s:type="y:string">BE</ns1:countryCode>
<ns2:vatNumber
xmlns:ns2="urn:ec.europa.eu:taxud:vies:services:checkVat"
s:type="y:string">0810416786</ns2:vatNumber>
</m:checkVat>
</E:Body>
</E:Envelope>
RESPONSE:
HTTP/1.1 500 Internal Server Error
Date: Wed, 04 Jun 2014 09:33:11 GMT
Transfer-Encoding: chunked
Content-Type: text/xml; charset=UTF-8
Server: Europa
Connection: Keep-Alive
Transfer is Chunked!
01d7
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> soap:Client Unmarshalling Error: unexpected element (uri:"urn: ec.europa.eu:taxud:vies:services:checkVat", local:"countryCode"). Expected elements are <{urn: ec.europa.eu:taxud:vies:services:checkVat:types}vatNumber>,<{urn: ec.europa.eu:taxud:vies:services:checkVat:types}countryCode>
0000
GetChunkLength: 01d7 = 471
Connection Disconnected
SOAPLOG END
Now i tried the to cut and paste the above soap envelop in SOAPUI , and it gives me the exact same error message as in the soaplog.
I then tried creating a request through SOAPUI but based on the wdsl ,SOAPUI is giving me a different soap envelop as the one PB generated ?
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ec.europa.eu:taxud:vies:services:checkVat:types">
<soapenv:Header/>
<soapenv:Body>
<urn:checkVat>
<urn:countryCode>?</urn:countryCode>
<urn:vatNumber>?</urn:vatNumber>
</urn:checkVat>
</soapenv:Body>
</soapenv:Envelope>
If i enter parameters in the above envelop and check it through SOAPUI , i end up having the result i want.
Is there any way we can manipulate the soap envelop contents ? Or does anyone have any idea why the soap envelop generated by PB ends up having the above mentioned error in the soaplog file ?
What am i missing ?
TIA
John