Forum Moderators: open

Message Too Old, No Replies

SOAP and ASP

..any pointers?

         

giggle

12:05 pm on Aug 2, 2010 (gmt 0)

10+ Year Member



Hi

One of our main suppliers has emailed a manual of their SOAP interface (lots of XML code).

I've never coded anything ASP/SOAP/XML and, frankly, I'm out of my depth.

I've googled around and there are lots of sites that detail what to do, but it's a bit beyond me.

I was (really) hoping that someone out there had an old piece of "classic" ASP code that says something to the effect of plug your XML bits in here and get the results here...

My fingers are crossed as people are depending on me (poor souls).

Thanks

Mick

Ocean10000

4:08 pm on Aug 3, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I don't think any one here has a cookie cutter code that works in all cases. Is the interface such that you query it to pull down data or is it designed so that you can update data in their system via automated means.

Usually web services which are designed for data pulls are simpler to implement in asp. But without more information all I can do is make generalizations.

Demaestro

7:46 pm on Aug 3, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What are the requirements for your SOAP interaction?

Typically with SOAP exchanges you post XML and receive posts in XML. Sometimes you post and get a response. Sometimes you don't.

To keep it simple in your head think of it like this.

When you have a form, you post it to a page on a server, the server parses the form and does 'stuff' with the data. Same with SOAP except instead of a form being posted you receive a string of xml.

Using something like curl or httplib you can post xml in a SOAP request and retrieve the response if any.

To receive a post it will be much like receiving an HTML form post but instead of parsing the form you parse the XML.

If you post an overview of the requirements it will be easier to help.

I have some examples in Python if you are interested.

giggle

6:23 am on Aug 4, 2010 (gmt 0)

10+ Year Member



Thanks for the replies. I still can't get my head around it.

When I ask for examples I get XML. I'm supposed to write something to, for example, post the XML and get a list of locations back.

For example, the top part of an example XML file they sent me is:

<definitions name="stationlist" targetNamespace="http://SITE.EXT/stationlist">
<!-- Micro Focus ServerExpress generated WSDL document-->

<types>
<schema elementFormDefault="qualified" targetNamespace="http://SITE.EXT/stationlist">
<complexType name="StationListRQ">
<sequence>
<element name="Country" type="string"/>
<element name="Language" type="string"/>
<element name="UserID">
<complexType>
<sequence>
<element name="CustomerName" type="string"/>
<element name="Specification" type="string"/>
<element name="InternalUse" type="string"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
etc...

Now I'm not sure if it's XML or SOAP or indeed if there is a difference.

I've been looking at this screen for help:

[4guysfromrolla.com...]

but the XML/SOAP looks nothing like it!?

Mick

Demaestro

3:55 pm on Aug 4, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The difference between SOAP and XML is really just the headers that get set. Think of soap as a type of XML.

Here is a pseudo code of what I use. I am using httplib for this example to do the job of posting and waiting for the response.

the_soap = <soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:plat='http://example.com/'><soapenv:Header/><soapenv:Body><plat:do><this>this</this><that>that</that></plat:do></soapenv:Body></soapenv:Envelope>

headers = {"Host": "example.com", "Content-type": "text/xml;charset=UTF-8", "Content-Length": len(the_soap), "SOAPAction": ""}

conn = httplib.HTTPConnection("example.com")

conn.request("POST", "/path/posting_to.asp", the_soap, headers)

response = conn.getresponse()

response_data = response.read()

conn.close()

**************************

You can view the response by outputting 'response_data'

You most likely will need to change the headers and SOAP tags but it is all there. You just need to know your params and sub them in.