cancel
Showing results for 
Search instead for 
Did you mean: 

CALL SAP WEB SERVICE FROM MS EXCEL 2010 using VBA

Former Member
0 Kudos

*"----------------------------------------------------------------------

*"*"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"
?> 
+<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"
-<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>

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

    'sURL = "http://webservices.gama-system.com/exchangerates.asmx?op=CurrentConvertToEUR"]http://webservices.gam...]"

       sURL = "http://ides.studynest.org:8023/sap/bc/srt/wsdl/sdef_ZWS_TEST_UDAY_WEB/wsdl11/ws_policy/document?sap-..."

    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-..."

        .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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

the url to your web service needs to be the endpoint.  It looks like you copied the url from the service in se80.  Instead, go to SOA manager and get the wsdl.  Then put the wsdl in the web browser and extract the endpoint.  it will be in the tags:  "soap:address location="