Send XML Document over SOAP

S

Scott Rubin

Hello again,

While I wait for SOAP/SSL to be implemented I have another problem. I
have a web service running with many clients. The way it is set up is
that through a web interface the admin will change the configurations of
the clients. The clients will all have XML documents stored locally
containing their settings. When changes are made the web service will
send a new version of that XML document to the client VIA soap. My
problem is that I can't seem to embed the XML document into the SOAP
envelope and have it work on the other end. Many sites on the net say
to use a SOAP attachment, but this wont work for our purposes.

The best I've gotten it to do is have the response be a
SOAP::Mapping:Object. This kind of works, but it doesn't give me access
to attributes, multiple elements of the same name, or the type of the
root element in the xml document.

Let me re-phrase the question again, to be sure. I want to do the
following. First, connect to a webservice using soap4r
SOAP::RPC::Driver. Then call a function and recieve a response. I want
that response to be, or be turned into, something I can pass to rexml to
be parsed. Something like a Document object or a string of the xml
document.

Thanks for help.

Scott
 
J

James Britt

Scott said:
Hello again,

While I wait for SOAP/SSL to be implemented I have another problem. I
have a web service running with many clients. The way it is set up is
that through a web interface the admin will change the configurations of
the clients. The clients will all have XML documents stored locally
containing their settings. When changes are made the web service will
send a new version of that XML document to the client VIA soap. My
problem is that I can't seem to embed the XML document into the SOAP
envelope and have it work on the other end. Many sites on the net say
to use a SOAP attachment, but this wont work for our purposes.

I'm not a big fan of SOAP; too complicated for my tastes, and, as I
recall, there are a few restrictions on what you may include as content.
For example, you may not include an XML doc that has a DOCTYPE
declaration. It breaks SOAP. (But check this; it's been a while since
I did any serious research on SOAP. I tend to prefer XML-RPC)

You could perhaps base64 encode the XML package and send it as "simple"
string, then decode it at the client. Or it may be possible to wrap the
payload doc in a CDATA section (but watch that the payload itself
doesn't contain CDATA sections).



James
 
D

dhtapp

You could perhaps base64 encode the XML package and send it as "simple"
string, then decode it at the client. Or it may be possible to wrap the
payload doc in a CDATA section (but watch that the payload itself
doesn't contain CDATA sections).

Scott,

Something like this sounds way easier and more flexible than trying to break
down the XML doc into key-value pairs and re-assemble it on the other side.

One of the more useful treatments I've found on SOAP is Chapter 2 of
Elliotte Rusty Harold's detailed explanation, at
http://www.ibiblio.org/xml/books/xmljava/chapters/.


- dan
 
N

NAKAMURA, Hiroshi

Hi,
From: "Scott Rubin" <[email protected]>
Sent: Friday, April 09, 2004 5:05 AM
While I wait for SOAP/SSL to be implemented I have another problem. I

Same man responding. :)
The best I've gotten it to do is have the response be a
SOAP::Mapping:Object. This kind of works, but it doesn't give me access
to attributes, multiple elements of the same name, or the type of the
root element in the xml document.
Let me re-phrase the question again, to be sure. I want to do the
following. First, connect to a webservice using soap4r
SOAP::RPC::Driver. Then call a function and recieve a response. I want
that response to be, or be turned into, something I can pass to rexml to
be parsed. Something like a Document object or a string of the xml
document.

If I understand the problem correctly, your client wants to call the
service with "rpc/encoded" and want to get response with
"document/literal" or "rpc/literal" right?

Current soap4r rpc driver implementation can handle rpc/encoded,
rpc/literal, document/literal, but has some restrictions.
* call and response must be the same mode.
* literal XML cannot have CDATA, PI, etc. etc.

Can I see the call and response sample XML, could be privately?
I might be able to find a workaround.
If not, I'll show you examples for you to find one.

Regards,
// NaHi
 
N

NAKAMURA, Hiroshi

Hi,
From: "James Britt" <[email protected]>
Sent: Friday, April 09, 2004 9:35 AM
I'm not a big fan of SOAP; too complicated for my tastes, and, as I
recall, there are a few restrictions on what you may include as content.
For example, you may not include an XML doc that has a DOCTYPE
declaration. It breaks SOAP. (But check this; it's been a while since
I did any serious research on SOAP. I tend to prefer XML-RPC)

I know James already know, but for ML people, I point out
that it's not SOAP's fault about including XML document problem.
It's the issue about XML in XML. If you must embed any kind
of XML document to send, you cannot use XML directly as a wire format.

Sorry if it's unnecessary addition.

Regards,
// NaHi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top