SOAP Web Services

seraphax

New Member
Hi, I'm new to developing with basic4ppc.

I'm trying to develop an application that will send XML to a web service (this is an Axis based, so a Java web service) and will accept the response and interpret the XML that is sent back to the handheld.

I've seen a few examples, but not which stream XML to a service.

Has anyone got any experience of this? or any samples of how this could work? if it even can work?

Thanks in advance.
 

agraham

Expert
Licensed User
Longtime User
You should be able to exchnge SOAP messages with with the HTTP library as SOAP is built on the HTTP protocol, but you will have to build and parse the SOAP XML messages yourself.

However I have found that the underlying .NET HTTP code, on which the HTTP library relies, is very picky about the correct protocol. I have just written a remote monitoring app and the HTTP based server I was connecting to sends back badly formatted responses under some situations. Internet Explorer is OK with this server as it seems very tolerant of protocol errors but .NET isn't. As the server code was not accessible to fix the problem at source (;)) I had to use the Network library and implement my own (trivial) version of HTTP on top of that to get it working.
 

seraphax

New Member
You should be able to exchnge SOAP messages with with the HTTP library as SOAP is built on the HTTP protocol, but you will have to build and parse the SOAP XML messages yourself.

However I have found that the underlying .NET HTTP code, on which the HTTP library relies, is very picky about the correct protocol. I have just written a remote monitoring app and the HTTP based server I was connecting to sends back badly formatted responses under some situations. Internet Explorer is OK with this server as it seems very tolerant of protocol errors but .NET isn't. As the server code was not accessible to fix the problem at source (;)) I had to use the Network library and implement my own (trivial) version of HTTP on top of that to get it working.

Thanks for the quick response! it's good to know that someone else has got it working- I've certainly found there's generally issues with Microsoft code communicating with Java based web services (so much for global standards).

If you have any code that you could post I would be eternally grateful.

Cheers
 

agraham

Expert
Licensed User
Longtime User
it's good to know that someone else has got it working
Just to be clear, it's HTTP protocol based communication that I got working, not SOAP. But as SOAP is merely an XML formatted HTTP message I would expect it to work. I don't think I have any code that would help you, my problem was with authentication and I had to implement the basic authentication exchange with a secure server on top of the Network library as the HTTP library didn't like the server's authentication messages.
 

kawawong

Member
Licensed User
Longtime User
Hi,

I am also interesting to develop the application that can connect a web service via soap.

Is there any example or library for this issue?

Many many thanks.

Kawawong
 

zdenkot

Member
Licensed User
Longtime User
Hi,
I am looking for help with SOAP method.
Please review the my code.
Any suggestion is welcome !

Thank you, Zdenko

Sub Globals
'Dim buffer(0) As byte
Dim buffer(4096) As byte
Dim len
Dim URL
End Sub
Sub App_Start
url = "http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate"
bit.New1 'bit is a Bitwise object
FileOpen(c1,"ff.xml",cRandom)
bin.New1(c1,true)
len = bin.ReadBytes(buffer(), 4096)
FileClose(c1)

postdate
End Sub
Sub PostDate
Response.New1
'Request.New1("http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate")
Request.New1("http://www.webservicex.net/CurrencyConvertor.asmx")
'request.ContentType = "application/x-www-form-urlencoded"
' request.ContentType = "application/soap+xml"
request.ContentType = "text/xml"
request.ContentLength = len
request.Method = "POST"
Request.TimeOut = 30000 '30 seconds
writer.New1(request.GetStream,false)
writer.WriteBytes2(buffer(),0,len)

response.Value = request.GetResponse
Msgbox(response.GetString)
response.Close

' content of ff.xml file
'------------------------
''<?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:Body>
'' <ConversionRate xmlns="http://www.webserviceX.NET/">
'' <FromCurrency>EUR</FromCurrency>
'' <ToCurrency>USD</ToCurrency>
'' </ConversionRate>
'' </soap:Body>
''</soap:Envelope>
End Sub
 
Top