Hello All,
I have a requirement ,where I have to call SAP web service through MS excel using VBA.
For that I have created RFC enabled Function Module and WEB service is created.
But I am getting an error. Please Find the attachment for the error.
I have share the code also.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(PROCESS_TYPE) TYPE CRMT_PROCESS_TYPE
*" VALUE(SUCCESS) TYPE CRMT_PROBABILITY OPTIONAL
*" EXPORTING
*" VALUE(MESSAGE) TYPE CHAR255
*" VALUE(OBJECT_ID) TYPE CRMT_OBJECT_ID
Code of WEB SERVICE
<?xml
version="1.0" encoding="utf-8" ?>
version="1.0" encoding="utf-8" ?>
+<wsdl:definitions
targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="urn:sap-com:document:sap:soap:functions:mc-style" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:n1="urn:sap-com:document:sap:rfc:functions"
targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="urn:sap-com:document:sap:soap:functions:mc-style" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:n1="urn:sap-com:document:sap:rfc:functions"
-<wsdl:documentation>
Importing parameter for WEB Service
<n0:ZcrmOrderMaintainUday xmlns:n0="urn:sap-com:document:sap:soap:functions:mc-style">
<Phase>Str</Phase>
<ProcessType>Stri</ProcessType>
</n0:ZcrmOrderMaintainUday>
<Phase>Str</Phase>
<ProcessType>Stri</ProcessType>
</n0:ZcrmOrderMaintainUday>
Code IN VBA(EXCEL)
Private Sub CommandButton1_Click()
Dim sURL As String
Dim sEnv As String
Dim xmlhtp As New MSXML2.XMLHTTP40
Dim xmlDoc As New DOMDocument
sEnv = "<?xml version=""1.0"" encoding=""utf-8""?>"
sEnv = sEnv & "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
'sEnv = sEnv & "<soap:Envelope xmlns:xsi="""http://www.w3.org/2001/XMLSchema-instance"http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd="""http://www.w3.org/2001/XMLSchema"]http://www.w3.org/2001/XMLSchema[/URL]"" xmlns:soap=""[URL="http://schemas.xmlsoap.org/soap/envelope/"]http://schemas.xmlsoap.org/soap/envelope/"">"
sEnv = sEnv & " <soap:Body>"
sEnv = sEnv & " <sdef_ZWS_TEST_UDAY_WEB xmlns=""http://ides.studynest.org/webservices" > ""
sEnv = sEnv & " <DESC>Test Of Visit Reprot by Prasmi</DESC>"
sEnv = sEnv & " <PROCESS_TYPE>LEAD</PROCESS_TYPE>"
sEnv = sEnv & " </sdef_ZWS_TEST_UDAY_WEB>"
sEnv = sEnv & " </soap:Body>"
sEnv = sEnv & "</soap:Envelope>"
With xmlhtp
.Open "post", sURL, False
.setRequestHeader "Host", "ides.studynest.org"
.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
.setRequestHeader "soapAction", "http://ides.studynest.org:8023/sap/bc/srt/wsdl/sdef_ZWS_TEST_UDAY_WEB/wsdl11/ws_policy/document?sap-client=800"
.setRequestHeader "Accept-encoding", "zip"
.send (sEnv)
xmlDoc.LoadXML .responseText
MsgBox .responseText
End With
End Sub
I am getting the ERROR. Please find the attachment for the error.
Please guide me to over come the Error,
Thanks In Advance.
Regards
RR Padhan