Help creating an xml / soap message

Hey, I am really new to this part of xojo, never done it before.
I need to create this soap message :

<soap:Envelope xmlns:soap=“http://schemas.xmlsoap.org/soap/envelope/
xmlns:xsd=“http://www.w3.org/2001/XMLSchema
xmlns:xsi=“http://www.w3.org/2001/XMLSchemainstance”>
soap:Header


[PROVIDERID]

[USERNAME]
[PASSWORD]/password>



[HOTELID]


</soap:Header>
soap:Body</soap:Body>
</soap:Envelope>

I though it’s be easier if I just build it as an xml, forgetting all the soap hassle (which I never done either)… But I am not getting it right…
Any help, guidance or tips will be very much apreciatted…

Thanks in adavnce
Roman

Do you need to make any other communications?
The kill it with fire method would be to just use ReplaceAll.

But I would not recommend that unless you absolutely cannot get the regular methods to work, and you only need this one communication.

Hey Tim…
Yes, I DO need to make other communications.

Actually as a long term strategy I would like to learn how to create the XML.

I thought about just replacing the [fields] but then I should create a constant for every message I need to send and deal with the '"'quotes, etc. It’s not a very elegant solution, is it?

No and you should not do that. What I meant by “kill it with fire” was it’s a bad idea, highly inefficient, but it should work.

If you’re going to make more than one communication you should find out the best means to do so. Unfortunately, I do not have any insight into that matter as I haven’t needed to communicate by SOAP in my experience yet.

With anything that has a regular form such as XML, create helper methods that take most of the drudgery out of it. I find the Xojo xml class rather cumbersome when it comes to creating a document piece by piece. It’s great for working with an existing document, but no so much when creating one. I personally wrote methods that put the document together using strings and arrays, but you could just as easily automate creation of xml using the Xojo XMLNode as storage. It would certainly be more “proper”. I posted my code somewhere on the forum. I could dig it out if need be.

Hey Tim… I’d be very interested in looking/using your methods, I am sure they would be of great use and I’ll probably learn a lot.

If you can find easily where you post that code, and share a link I’d appreciate. I can also lookup in the forum myself but Im not sure where where to start…

What didnt work?

Ive done it ‘your way’ myself.
It makes sending pretty easy.

But if you get an XML packet back, sometimes you need to transform into an XMLDocument to understand the reply.

A:/ If you use the REPLACEALL method on the XML string, things you need to watch for are:
" can be replaced with ’
eg
http://schemas.xmlsoap.org/soap/envelope/” ->
http://schemas.xmlsoap.org/soap/envelope/

or use chrb(34)

b:/ XML inside XML often needs to be ‘wrapped’ inside a [[CODE section
c/ some characters may need to be ‘escaped’ such as & , £ and even carriage returns in text

You can send the message as an HTTP POST message
The response … you could use INSTR to look for <HOTELXYZ or whatever, and parse from there
But better too pop it into an XMLDocument and use XQL to find a node and check the value.

Here’s the conversation: https://forum.xojo.com/12994-free-xml-builder-class

That’s what I do, too. I create the xml to send “by hand”, send it with a POST message, then put the response into an XMLDocument and use XQL to pull out the pieces I’m interested in. Works great.