troubleshooting Question

convert asp soap request to php soap request

Avatar of jtch07
jtch07 asked on
PHPWeb Services
19 Comments1 Solution1542 ViewsLast Modified:
I am new to xml and web services -
I  have an example of a web service request in asp and need to get it into php
I have spent hours trying to understand soap wsdl etc and get this to work with no luck
I would appreciate it if someone would show me what this should look like in php

<%@ Language=VBScript %>
<% OPTION EXPLICIT %>
<%
      dim Account, Username, Password, WebService_URL
      
      Account = "DEMO_415_Standard"
      Username = "DEMO_415_Standard"
      Password = "1234"
      WebService_URL = "http://demo.golfbox.dk/web/services/webservice/news.asmx"

      dim soapMessage, SOAPObject, soapResult

      soapMessage = "<?xml version=""1.0"" encoding=""utf-8""?>" &_
      "<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/"">" &_
      "<soap:Header>" &_
            "<UserCredentials xmlns=""http://golfbox.net/web/services/webservice"">" &_
            "<Account>" & Account & "</Account>" &_
            "<Username>" & Username & "</Username>" &_
            "<Password>" & Password & "</Password>" &_
            "</UserCredentials>" &_
      "</soap:Header>" &_
      "<soap:Body>" &_
            "<GetList xmlns=""http://golfbox.net/web/services/webservice/news"">" &_
            "<HeadersOnly>false</HeadersOnly>" &_
            "</GetList>" &_
      "</soap:Body>" &_
      "</soap:Envelope>"

      set SOAPObject = server.CreateObject("MSXML2.ServerXMLHTTP")
      call SOAPObject.Open("POST", WebService_URL, false)

      call SOAPObject.setRequestHeader("Content-Type", "text/xml; charset=utf-8")
      call SOAPObject.setRequestHeader("Content-Length", len(soapMessage))
      call SOAPObject.setRequestHeader("SOAPAction", "http://golfbox.net/web/services/webservice/GetList")

      call SOAPObject.send(soapMessage)

      if SOAPObject.ReadyState = 4 then

            set soapResult = server.CreateObject("msxml2.domdocument.4.0")
            call soapResult.loadXML(SOAPObject.responseText)
            dim nodes : set nodes = SOAPResult.selectNodes("//NewsItem")
            
            dim g
            for g = 0 to nodes.length - 1
                  if nodes(g).selectSingleNode("GUID").text = request.QueryString("News_GUID") then
                        response.Write("<b>&raquo;&nbsp;<a href=""ws_getnews.asp?News_GUID=" & server.URLEncode(nodes(g).selectSingleNode("GUID").text) & """>" & nodes(g).selectSingleNode("Subject").text & "</a></b><br>")
                        response.Write("<div style=""padding-left:15px"">" & nodes(g).selectSingleNode("Body").text & "</div><br/>")
                  else
                        response.Write("&raquo;&nbsp;<a href=""ws_getnews.asp?News_GUID=" & server.URLEncode(nodes(g).selectSingleNode("GUID").text) & """>" & nodes(g).selectSingleNode("Subject").text & "</a><br>")
                  end if
            next
      
      end if
%>
ASKER CERTIFIED SOLUTION
Rose Babu
Senior Head Of Enterprise Architecture

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 19 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 19 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros