Generate SOAP request and response in ASP

Good Evening,
     I'm new to using SOAP protocol and XML; I have the need to create a way to transmit a request and get a response from a server.  I have read several other answers; but I'm still a little confused... I started by using soapUI and it appears that the request and response work well within the application; but I really would like to take it to ASP and be able to run it against a DB and update the values back onto the DB... any help would be greatly appreciate it...
<?xml version="1.0" encoding="UTF-8"?>
<con:soapui-project name="Danny" resourceRoot="" soapui-version="3.5" abortOnError="false" runType="SEQUENTIAL" xmlns:con="http://eviware.com/soapui/config"><con:settings/><con:interface xsi:type="con:WsdlInterface" wsaVersion="NONE" name="NameAddressInfobaseEndpointBinding" type="wsdl" bindingName="{http://id.acxiom.com/infobase-nameAddress/1.0}NameAddressInfobaseEndpointBinding" soapVersion="1_1" anonymous="optional" definition="https://Idtest.acxiom.com/infobase-nameAddress/1.0?WSDL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.actions.iface.tools.dotnet.DotNetWsdlAction@values-local"><![CDATA[<xml-fragment xmlns:con="http://eviware.com/soapui/config">
  <con:entry key="protocol" value="SOAP"/>
  <con:entry key="base url" value=""/>
  <con:entry key="password" value=""/>
  <con:entry key="Tool Args" value=""/>
  <con:entry key="namespace" value=""/>
  <con:entry key="output directory" value=""/>
  <con:entry key="username" value=""/>
  <con:entry key="proxy password" value=""/>
  <con:entry key="Use cached WSDL" value="true"/>
  <con:entry key="order" value="false"/>
  <con:entry key="proxy domain" value=""/>
  <con:entry key="serverInterface" value="false"/>
  <con:entry key="sharetypes" value="false"/>
  <con:entry key="proxy" value=""/>
  <con:entry key="domain" value=""/>
  <con:entry key="enableDataBinding" value="false"/>
  <con:entry key="WSDL" value="https://Idtest.acxiom.com/infobase-nameAddress/1.0?WSDL"/>
  <con:entry key="url key" value=""/>
  <con:entry key="language" value="JS"/>
  <con:entry key="proxy username" value=""/>
  <con:entry key="fields" value="false"/>
</xml-fragment>]]></con:setting></con:settings><con:definitionCache type="TEXT" rootPart="https://Idtest.acxiom.com/infobase-nameAddress/1.0?WSDL"><con:part><con:url>https://Idtest.acxiom.com/infobase-nameAddress/1.0?WSDL</con:url><con:content><![CDATA[<definitions name="NameAddressInfobase" targetNamespace="http://id.acxiom.com/infobase-nameAddress/1.0" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://id.acxiom.com/infobase-nameAddress/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <types>
    <schema targetNamespace="http://id.acxiom.com/infobase-nameAddress/1.0" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <complexType name="getByNameAddress">
        <sequence>
          <element name="NameAddressInfobaseInput_1" nillable="true" type="tns:NameAddressInfobaseInput"/>
        </sequence>
      </complexType>
      <complexType name="NameAddressInfobaseInput">
        <sequence>
          <element maxOccurs="unbounded" minOccurs="0" name="customData" nillable="true" type="tns:CustomData"/>
          <element name="name" nillable="true" type="tns:Name"/>
          <element name="orderId" nillable="true" type="string"/>
          <element name="unparsedAddress" nillable="true" type="tns:UnparsedAddress"/>
        </sequence>
      </complexType>
      <complexType name="CustomData">
        <sequence>
          <element name="name" nillable="true" type="string"/>
          <element name="value" nillable="true" type="string"/>
        </sequence>
      </complexType>
      <complexType name="Name">
        <sequence>
          <element name="firstName" nillable="true" type="string"/>
          <element name="lastName" nillable="true" type="string"/>
          <element name="middleInitial" nillable="true" type="string"/>
          <element name="suffix" nillable="true" type="string"/>
        </sequence>
      </complexType>
      <complexType name="UnparsedAddress">
        <sequence>
          <element maxOccurs="unbounded" minOccurs="0" name="addressLines" nillable="true" type="string"/>
          <element name="city" nillable="true" type="string"/>
          <element name="postalCode" nillable="true" type="string"/>
          <element name="state" nillable="true" type="string"/>
          <element name="urbanization" nillable="true" type="string"/>
        </sequence>
      </complexType>
      <complexType name="getByNameAddressResponse">
        <sequence>
          <element name="result" nillable="true" type="tns:NameAddressInfobaseOutput"/>
        </sequence>
      </complexType>
      <complexType name="NameAddressInfobaseOutput">
        <sequence>
          <element maxOccurs="unbounded" minOccurs="0" name="IBEOutput" nillable="true" type="tns:IBEOutput"/>
        </sequence>
      </complexType>
      <complexType name="IBEOutput">
        <sequence>
          <element name="name" nillable="true" type="string"/>
          <element name="value" nillable="true" type="string"/>
        </sequence>
      </complexType>
      <complexType name="InputValidationException">
        <sequence>
          <element name="message" nillable="true" type="string"/>
        </sequence>
      </complexType>
      <complexType name="SystemUnavailableException">
        <sequence>
          <element name="message" nillable="true" type="string"/>
        </sequence>
      </complexType>
      <element name="getByNameAddress" type="tns:getByNameAddress"/>
      <element name="getByNameAddressResponse" type="tns:getByNameAddressResponse"/>
      <element name="SystemUnavailableException" type="tns:SystemUnavailableException"/>
      <element name="InputValidationException" type="tns:InputValidationException"/>
    </schema>
  </types>
  <message name="NameAddressInfobaseEndpoint_getByNameAddressResponse">
    <part element="tns:getByNameAddressResponse" name="result"/>
  </message>
  <message name="SystemUnavailableException">
    <part element="tns:SystemUnavailableException" name="SystemUnavailableException"/>
  </message>
  <message name="NameAddressInfobaseEndpoint_getByNameAddress">
    <part element="tns:getByNameAddress" name="parameters"/>
  </message>
  <message name="InputValidationException">
    <part element="tns:InputValidationException" name="InputValidationException"/>
  </message>
  <portType name="NameAddressInfobaseEndpoint">
    <operation name="getByNameAddress">
      <input message="tns:NameAddressInfobaseEndpoint_getByNameAddress"/>
      <output message="tns:NameAddressInfobaseEndpoint_getByNameAddressResponse"/>
      <fault message="tns:InputValidationException" name="InputValidationException"/>
      <fault message="tns:SystemUnavailableException" name="SystemUnavailableException"/>
    </operation>
  </portType>
  <binding name="NameAddressInfobaseEndpointBinding" type="tns:NameAddressInfobaseEndpoint">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="getByNameAddress">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
      <fault name="InputValidationException">
        <soap:fault name="InputValidationException" use="literal"/>
      </fault>
      <fault name="SystemUnavailableException">
        <soap:fault name="SystemUnavailableException" use="literal"/>
      </fault>
    </operation>
  </binding>
  <service name="NameAddressInfobase">
    <port binding="tns:NameAddressInfobaseEndpointBinding" name="NameAddressInfobaseEndpointPort">
      <soap:address location="http://idtest.acxiom.com:80/infobase-nameAddress/1.0"/>
    </port>
  </service>
</definitions>]]></con:content><con:type>http://schemas.xmlsoap.org/wsdl/</con:type></con:part></con:definitionCache><con:endpoints><con:endpoint>https://idtest.acxiom.com/infobase-nameAddress/1.0</con:endpoint></con:endpoints><con:operation isOneWay="false" action="" name="getByNameAddress" bindingOperationName="getByNameAddress" type="Request-Response" inputName="" receivesAttachments="false" sendsAttachments="false" anonymous="optional"><con:settings/><con:call name="Request 1"><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers">&lt;xml-fragment/></con:setting></con:settings><con:encoding>UTF-8</con:encoding><con:endpoint>https://idtest.acxiom.com/infobase-nameAddress/1.0</con:endpoint><con:request><![CDATA[<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://id.acxiom.com/infobase-nameAddress/1.0">
   <soapenv:Header/>
   <soapenv:Body>
     <ns:getByNameAddress>
         <NameAddressInfobaseInput_1>

            <name>
               <firstName>FIRST</firstName>
               <lastName>LAST</lastName>
               <middleInitial></middleInitial>
               <suffix></suffix>
            </name>
            <orderId>1111</orderId>
            <unparsedAddress>
               <!--Zero or more repetitions:-->
               <addressLines>124 STREET</addressLines>
               <city>ANYWHERE</city>
               <postalCode>11101</postalCode>
               <state>NY</state>
               <urbanization></urbanization>
            </unparsedAddress>
         </NameAddressInfobaseInput_1>
      </ns:getByNameAddress>

   </soapenv:Body>
</soapenv:Envelope>
]]></con:request><con:credentials><con:username>user</con:username><con:password>pass</con:password></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:wsaConfig mustUnderstand="NONE" version="200508" action="http://id.acxiom.com/infobase-nameAddress/1.0/NameAddressInfobaseEndpoint/getByNameAddressRequest"/><con:wsrmConfig version="1.2"/></con:call></con:operation></con:interface><con:properties/><con:wssContainer/></con:soapui-project>

Open in new window

pmcdevelopAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pmcdevelopAuthor Commented:
Hi again... ok... I'm trying to wrap my head around this... here is a sample that I found online... however it would appear that the sample does not require authentication (username/password) and that the source is an xml list (in my case I'm going after a DB source)... what I would like to know is the basic hearder information that I need in order to pass the proper xml request.   thanks again for any help.

<%
Dim objXMLHTTP : SET  objXMLHTTP = Server.CreateObject("Msxml2.XMLHTTP.3.0")
Dim objOutputXMLDoc : Set objOutputXMLDoc = Server.CreateObject("MSXML.DOMDocument")
 
Dim strMethodPkg
Dim strMethodResultXML
 
Dim catID            :      catID = request("catID")
Dim Html_Strip      : Html_Strip = 1
 
 
strMethodPkg ="<?xml version=""1.0"" encoding=""utf-8""?>"
strMethodPkg = strMethodPkg &"<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/"">"
strMethodPkg = strMethodPkg & "<soap:Body>"
strMethodPkg = strMethodPkg & "<Product_List_Xml xmlns=""http://www.estaronline.com/webservices/"">"
strMethodPkg = strMethodPkg & "<catID>" & catID &"</catID>"
strMethodPkg = strMethodPkg & "<Html_Strip>1</Html_Strip>"
strMethodPkg = strMethodPkg & "</Product_List_Xml></soap:Body></soap:Envelope>"
 
objXMLHTTP.open "post", "http://www.champions.co.nz/shop/products2.asmx", False
 
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strMethodPkg)
 
objXMLHTTP.setRequestHeader "SOAPAction", "http://www.estaronline.com/webservices/Product_List_Xml"
 
Call objXMLHTTP.send(strMethodPkg)
 
strMethodResultXML = objXMLHTTP.responseText
 
objOutputXMLDoc.LoadXml(strMethodResultXML)
 
sXml = objOutputXMLDoc.SelectSingleNode("//Product_List_XmlResult").ChildNodes(0).xml
 
Set objXml = Server.CreateObject("Microsoft.XmlDom")
Set objXsl = Server.CreateObject("Microsoft.XmlDom")
 
objXml.LoadXml(sXml)
objXsl.Load(Server.MapPath("product.xslt"))
sProduct = objXml.transformNode(objXsl)
%>
Aaron JabamaniTechnical ArchitectCommented:
You want to pass custom header information  ? or your not sure what you are passing in below ?

 
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strMethodPkg)
 
pmcdevelopAuthor Commented:
Thanks for responding apeter; I guess I'm unsure about the header information that I should pass in order to have the authentication I need... I have tried to do some more research and I found a WSDL that the company recommends... I suppose that my biggest hurdle is understanding how I could place it in an ASP like format and pass the data down to my DB.  
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

pmcdevelopAuthor Commented:
Here is my first attempt to try to get a result from the server... I'm still not sure what I will get...
<%@ LANGUAGE="VBSCRIPT" %>
<%
'=====================================================================================
'= Paramount Marketing
'= 
'=====================================================================================
%>
<% Option Explicit %> 
<%
Dim objXMLHTTP : SET  objXMLHTTP = Server.CreateObject("Msxml2.XMLHTTP.3.0")
Dim objOutputXMLDoc : Set objOutputXMLDoc = Server.CreateObject("MSXML.DOMDocument")
 
Dim strMethodPkg
Dim strMethodResultXML
 
strMethodPkg ="<?xml version=""1.0"" encoding=""utf-8""?>"
strMethodPkg = strMethodPkg & "<env:Envelope xmlns:enc=""http://schemas.xmlsoap.org/soap/encoding/"" 
xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/""  xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" 
xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:ns0=""https://idtest.acxiom.com/infobase-nameAddress/1.0"">"
strMethodPkg = strMethodPkg & "<env:Body>"
strMethodPkg = strMethodPkg & "<userid xsi:type="xsd:string">XX123</userid>"
strMethodPkg = strMethodPkg & "<password xsi:type="xsd:string">password</password>"
strMethodPkg = strMethodPkg & "<ns0:getByNameAddress>"
strMethodPkg = strMethodPkg & "<NameAddressInfobaseInput_1>"
strMethodPkg = strMethodPkg & "<name>"
strMethodPkg = strMethodPkg & "<firstName>John</firstName>"
strMethodPkg = strMethodPkg & "<lastName>Doe</lastName>"
strMethodPkg = strMethodPkg & "<middleInitial>Q</middleInitial>"
strMethodPkg = strMethodPkg & "<suffix xsi:nil='1'/>"
strMethodPkg = strMethodPkg & "</name>"
strMethodPkg = strMethodPkg & "<orderId>0000</orderId>"
strMethodPkg = strMethodPkg & "<unparsedAddress>"
strMethodPkg = strMethodPkg & "<addressLines>1234 Main</addressLines>"
strMethodPkg = strMethodPkg & "<city>Little Rock</city>"
strMethodPkg = strMethodPkg & "<postalCode>72211</postalCode>"
strMethodPkg = strMethodPkg & "<state>AR</state>"
strMethodPkg = strMethodPkg & "<urbanization xsi:nil='1'/>"
strMethodPkg = strMethodPkg & "</unparsedAddress>"
strMethodPkg = strMethodPkg & "</NameAddressInfobaseInput_1>"
strMethodPkg = strMethodPkg & "</ns0:getByNameAddress>"
strMethodPkg = strMethodPkg & "</env:Body>"
strMethodPkg = strMethodPkg & "</env:Envelope>"

objXMLHTTP.open "post", "https://idtest.acxiom.com/infobase-nameAddress/1.0"
 
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strMethodPkg)
objXMLHTTP.setRequestHeader "SOAPAction", ""
 
objXMLHTTP.send strMethodPkg
 
strMethodResultXML = objXMLHTTP.responseText
response.write strMethodResultXML
response.write "end of file"
 
%>

Open in new window

pmcdevelopAuthor Commented:
this is the closest I've gotten... however now I can't seem to be able to get a response...
<%@ LANGUAGE="VBSCRIPT" %>
<%
'=====================================================================================
'= Paramount Marketing
'=
'=====================================================================================
%>
<% Option Explicit %>
<%
Dim objXMLHTTP : SET  objXMLHTTP = Server.CreateObject("Msxml2.XMLHTTP.3.0")
Dim objOutputXMLDoc : Set objOutputXMLDoc = Server.CreateObject("MSXML.DOMDocument")
Dim strMethodPkg
Dim strMethodResultXML
 
strMethodPkg ="<?xml version=""1.0"" encoding=""utf-8""?>"
strMethodPkg = strMethodPkg & "<env:Envelope xmlns:enc=""http://schemas.xmlsoap.org/soap/encoding/"" xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:ns0=""https://idtest.acxiom.com/infobase-nameAddress/1.0"">"
strMethodPkg = strMethodPkg & "<env:Body>"
strMethodPkg = strMethodPkg & "<ns0:getByNameAddress>"
strMethodPkg = strMethodPkg & "<NameAddressInfobaseInput_1>"
strMethodPkg = strMethodPkg & "<name>"
strMethodPkg = strMethodPkg & "<firstName>FIRST</firstName>"
strMethodPkg = strMethodPkg & "<lastName>LAST</lastName>"
strMethodPkg = strMethodPkg & "<middleInitial></middleInitial>"
strMethodPkg = strMethodPkg & "<suffix xsi:nil='1'/>"
strMethodPkg = strMethodPkg & "</name>"
strMethodPkg = strMethodPkg & "<orderId>1234</orderId>"
strMethodPkg = strMethodPkg & "<unparsedAddress>"
strMethodPkg = strMethodPkg & "<addressLines>123 WAY</addressLines>"
strMethodPkg = strMethodPkg & "<city>ANYWHERE</city>"
strMethodPkg = strMethodPkg & "<postalCode>12345</postalCode>"
strMethodPkg = strMethodPkg & "<state>NY</state>"
strMethodPkg = strMethodPkg & "<urbanization xsi:nil='1'/>"
strMethodPkg = strMethodPkg & "</unparsedAddress>"
strMethodPkg = strMethodPkg & "</NameAddressInfobaseInput_1>"
strMethodPkg = strMethodPkg & "</ns0:getByNameAddress>"
strMethodPkg = strMethodPkg & "</env:Body>"
strMethodPkg = strMethodPkg & "</env:Envelope>"

objXMLHTTP.open "post", "https://idtest.acxiom.com/infobase-nameAddress/1.0", false, "userid", "pass"
 
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strMethodPkg)
objXMLHTTP.setRequestHeader "SOAPAction", "send"
 
objXMLHTTP.send strMethodPkg
 
strMethodResultXML = objXMLHTTP.responseText
response.write strMethodResultXML
response.write "end of file"
 %>
Aaron JabamaniTechnical ArchitectCommented:
So what is the error message or response you are getting back ? Maybe the msg coming back will say what it is expecting. If no clue, then please ask the service provider.
pmcdevelopAuthor Commented:
I think I got it... now I'm just trying to format the response in a way that I can send it back to the DB as a field... but I believe that I can work on that... if anyone would like to see the final code... here it is...
thanks.
<%@ LANGUAGE="VBSCRIPT" %>
<%
'=====================================================================================
'= Paramount
'=
'=====================================================================================
%>
<% Option Explicit %> 
<%
Dim objXMLHTTP
Dim objOutputXMLDoc

Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
Set objOutputXMLDoc = CreateObject("MSXML.DOMDocument")
Dim strMethodPkg
Dim strMethodResultXML

strMethodPkg ="<?xml version=""1.0"" encoding=""utf-8""?>"
strMethodPkg = strMethodPkg & "<env:Envelope xmlns:enc=""http://schemas.xmlsoap.org/soap/encoding/"" 

xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" 

xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:ns0=""https://idtest.acxiom.com/infobase-nameAddress/1.0"">"
strMethodPkg = strMethodPkg & "<env:Body>"
strMethodPkg = strMethodPkg & "<ns0:getByNameAddress>"
strMethodPkg = strMethodPkg & "<NameAddressInfobaseInput_1>"
strMethodPkg = strMethodPkg & "<name>"
strMethodPkg = strMethodPkg & "<firstName>JOE</firstName>"
strMethodPkg = strMethodPkg & "<lastName>SMITH</lastName>"
strMethodPkg = strMethodPkg & "<middleInitial></middleInitial>"
strMethodPkg = strMethodPkg & "<suffix xsi:nil='1'/>"
strMethodPkg = strMethodPkg & "</name>"
strMethodPkg = strMethodPkg & "<orderId>1234</orderId>"
strMethodPkg = strMethodPkg & "<unparsedAddress>"
strMethodPkg = strMethodPkg & "<addressLines>112 tr ln</addressLines>"
strMethodPkg = strMethodPkg & "<city>ANYWHERE</city>"
strMethodPkg = strMethodPkg & "<postalCode>12345</postalCode>"
strMethodPkg = strMethodPkg & "<state>NY</state>"
strMethodPkg = strMethodPkg & "<urbanization xsi:nil='1'/>"
strMethodPkg = strMethodPkg & "</unparsedAddress>"
strMethodPkg = strMethodPkg & "</NameAddressInfobaseInput_1>"
strMethodPkg = strMethodPkg & "</ns0:getByNameAddress>"
strMethodPkg = strMethodPkg & "</env:Body>"
strMethodPkg = strMethodPkg & "</env:Envelope>"

objXMLHTTP.open "post", "https://idtest.acxiom.com/infobase-nameAddress/1.0", false, "user", "pass"
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strMethodPkg)
objXMLHTTP.setRequestHeader "SOAPAction", "send"
objXMLHTTP.send strMethodPkg

strMethodResultXML = objXMLHTTP.responseText
response.write(strMethodResultXML)
%>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.