cancel
Showing results for 
Search instead for 
Did you mean: 

Error Calling Web Service - VersionMismatch Wrong SOAP Version

0 Kudos

Hello,

I am attempting to create a web service from a function module, and to call this web service from outside of SAP.

I used the Web Service Creation Wizard to create a web service from BAPI_CURRENCY_GETLIST, and tested it using the Web Service Homepage button from transaction WSADMIN. Everything seems to work OK so far.

To test calling the web service, I copied the SOAP envelope from the web service homepage into a vbscript file:

Const HOST = "http://<server>.<domain>:<port>"

Const URL = "/sap/bc/srt/rfc/sap/ZWSD_Currency?sap-client=<nnn>"

' Create the HTTP object

Set xmlhttp = CreateObject("Microsoft.XMLHTTP")

Dim Request

Request = "<?xml version=""1.0"" encoding=""UTF-8"" ?>" & _

"<SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema"" xmlns:xs=""http://www.w3.org/2001/XMLSchema-instance"">" & _

"<SOAP-ENV:Header>" & _

"<sapsess:Session xmlns:sapsess=""http://www.sap.com/webas/630/soap/features/session/"">" & _

"<enableSession>true</enableSession>" & _

"</sapsess:Session>" & _

"</SOAP-ENV:Header>" & _

"<SOAP-ENV:Body>" & _

"<ns1:CurrencyGetlist xmnls:ns1='urn:sap-com:document:sap:soap:functions:mc-style'>" & _

"<CurrencyList><item>" & _

"<CURRENCY></CURRENCY>" & _

"<CURRENCY_ISO></CURRENCY_ISO>" & _

"<ALT_CURR></ALT_CURR>" & _

"<VALID_TO></VALID_TO>" & _

"<LONG_TEXT></LONG_TEXT>" & _

"</item></CurrencyList>" & _

"</ns1:CurrencyGetlist>" & _

"</SOAP-ENV:Body>" & _

"</SOAP-ENV:Envelope>"

xmlhttp.open "POST", HOST & URL, False

xmlhttp.send (request)

MsgBox (xmlhttp.responseXML.xml)

When I execute the vbscript, the response is

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelop/">

<soap-env:Body>

<soap-env:Fault>

<faultcode>

soap-env:VersionMismatch

</faultcode>

<faultstring xml:lang="en">

Wrong SOAP Version

</faultstring>

</soap-env:Fault>

</soap-env:Body>

</soap-env:Envelope>

The system log (transaction SM21) contains the messages:

SOAP Runtime: SOAP Fault exception occurred in program CL_SOAP_MESSAGE===============CP in include CL_SOAP_ME SSAGE===============CM00X at position 34

SOAP Runtime: Exception message: Severe processing error; SOAP fault handling required

In the RFC trace (transaction SM59) I see

XRFC> INFO 14:25:10: SOAP Transport Binding CL_SOAP_TRANSPORT_BINDING <

XRFC> ROOT->IFSOAP_TRANSPORT_BINDING~RESPONSE() Try to create response <

XRFC> message <

XRFC> <

XRFC> INFO 14:25:10: SOAP Transport Binding CL_SOAP_TRANSPORT_BINDING <

XRFC> ROOT->IFSOAP_TRANSPORT_BINDING~RESPONSE() Response message <

XRFC> created <

XRFC> <

XRFC> INFO 14:25:10: SOAP Transport binding CL_SOAP_HTTP_TPBND_ROOT <

XRFC> ->IF_SOAP_TRANSPORT_BINDING~RECEIVE() Try to receive message <

XRFC> <

XRFC> 20071218 142510 00037640: SOAP Fault Exception caught: : Wrong <

XRFC> SOAP Version <

XRFC> <

XRFC>

XRFC> End of user trace

How can I tell what version(s) of SOAP the NetWeaver 2004 platform supports? Has anyone seen and resolved this error?

Thanks in advance,

Mark

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

I guess the server is expecting the http header field SOAPAction: "". Notice, it might well be empty but it should be there. Don't know how to set HTTP headers in vb explicitly though.

hope it helps,

anton

0 Kudos

Hi Anton,

Thanks for the helpful suggestion. I did try setting SOAPAction using xmlhttp.setRequestHeader, but that didn't seem to make any difference. I may not have formatted the SOAP header correctly, however.

What I noticed is that if I added a slash at the end of the xmlns:soap tag in the SOAP envelope, I got a different error message (SOAP Processing failure, error id = 112).

I downloaded version 2.0 of the .NET framework and the SOAPSonar tool. SOAPSonar was able to format the SOAP envelope from the WSDL. When I pasted the SOAP envelope from SOAPSonar into my vbscript file, it worked. So, the vbscript looks like this:

Const HOST = "http://nwr051.nwenergy:1080"

Const URL = "/sap/bc/srt/rfc/sap/ZWSD_Currency?sap-client=100"

Const FORMAT = "dd-MMM-yy"

' Create the HTTP object

Set xmlhttp = CreateObject("Microsoft.XMLHTTP")

Dim Request

Request = "<?xml version=""1.0"" encoding=""utf-8""?>" & _

"<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:tns=""urn:sap-com:document:sap:soap:functions:mc-style"">" & _

" <soap:Body>" & _

" <tns:CurrencyGetlist>" & _

" <CurrencyList>" & _

" </CurrencyList>" & _

" </tns:CurrencyGetlist>" & _

" </soap:Body>" & _

"</soap:Envelope>"

xmlhttp.open "POST", HOST & URL, False

xmlhttp.send (request)

MsgBox (xmlhttp.responseXML.xml)

Again, thanks for taking the time to read through this and offer your insight.

Regards,

Mark

Answers (0)