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.
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).
From: “Scott Rubin” srubin@fsisys.com
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.
From: Scott Rubin [mailto:srubin@fsisys.com]
Sent: Thursday, April 08, 2004 3:06 PM
To: ruby-talk ML
Subject: Send XML Document over SOAP
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 know that at the company I work for, a group got around this by
converting the brackets into the html equivalent of > and <,
embedding that converted xml into the SOAP body and then doing the
reverse in the other side.
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 Processing XML with Java.
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.