You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by ma...@cnedi69.cnafmail.fr on 2001/06/05 14:53:19 UTC
Question about Parameters
Hi,
I'd like to send a service invocation to a server with any types parameter
.... for example, I have a "XML" file, I want to parse it and constructs a
DOM tree representation ... and I'd like to send it to a SOAP server in
order to get the content of an element ... so I tried to send a "call" with
one "dom.Document" parameter .... here is the client program (without catch
etc ....):
------------------------------------------------------------------------------------------------------------------------------------------------
String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
URL url = new URL("http://localhost ......");
SOAPMappingRegistry smr = new SOAPMappingRegistry();
BeanSerializer beanSer = new BeanSerializer();
try
{
Call call = new Call();
call.setSOAPMappingRegistry(smr);
call.setTargetObjectURI("urn:SOAP");
call.setMethodName("Getting");
call.setEncodingStyleURI(encodingStyleURI);
DOMParser parser = new DOMParser();
try
{
parser.parse("XMLFile.xml");
}
Document docXML = parser.getDocument();
Vector params = new Vector();
------------------> params.addElement(new Parameter("addedfile",
org.w3c.dom.Document.class, docXML, null));
call.setParams(params);
Response resp;
resp = call.invoke(url, "");
if (!resp.generatedFault ())
{
Parameter result = resp.getReturnValue ();
System.out.println((String)result.getValue ());
}
}
---------------------------------------------------------------------------------------------------------------------------------------
but it doesn't work because of :
[SOAPException: faultCode=SOAP-ENV:Client; msg=No Serializer found to
serialize a 'org.w3c.dom.Document' using encoding style "
http://schemas.xmlsoap.org/soap/encoding/'.;
targetException=java.lang.IllegalArgumentException: No Serializer found to
serialize a 'org.w3c.dom.Document' using encoding style
'http://schemas.xmlsoap.org/soap/encoding/'.]
at
org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.java:224)
at org.apache.soap.rpc.Call.invoke(Call.java:203)
at ClientSOAP.main(ClientSOAP.java:65)
What is the solution ?? what do I forget to do ???
thank you !!
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org
Re: Question about Parameters
Posted by Saint-Martin Cecile <cs...@symetrx.com>.
Try
params.addElement (new Parameter("addedfile", Element.class, docXML.getDocumentElement(),
org.apache.soap.Constants.NS_URI_LITERAL_XML));
Cecile Saint-Martin
csaintmartin@symetrx.com
----- Original Message -----
From: <ma...@cnedi69.cnafmail.fr>
To: <so...@xml.apache.org>
Sent: Tuesday, June 05, 2001 2:53 PM
Subject: Question about Parameters
> Hi,
>
> I'd like to send a service invocation to a server with any types parameter
> .... for example, I have a "XML" file, I want to parse it and constructs a
> DOM tree representation ... and I'd like to send it to a SOAP server in
> order to get the content of an element ... so I tried to send a "call" with
> one "dom.Document" parameter .... here is the client program (without catch
> etc ....):
> ----------------------------------------------------------------------------------------------------------------------------------
--------------
> String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
> URL url = new URL("http://localhost ......");
> SOAPMappingRegistry smr = new SOAPMappingRegistry();
> BeanSerializer beanSer = new BeanSerializer();
> try
> {
> Call call = new Call();
> call.setSOAPMappingRegistry(smr);
> call.setTargetObjectURI("urn:SOAP");
> call.setMethodName("Getting");
> call.setEncodingStyleURI(encodingStyleURI);
>
> DOMParser parser = new DOMParser();
> try
> {
> parser.parse("XMLFile.xml");
> }
> Document docXML = parser.getDocument();
>
> Vector params = new Vector();
> ------------------> params.addElement(new Parameter("addedfile",
> org.w3c.dom.Document.class, docXML, null));
>
> call.setParams(params);
>
> Response resp;
>
> resp = call.invoke(url, "");
>
>
> if (!resp.generatedFault ())
> {
> Parameter result = resp.getReturnValue ();
> System.out.println((String)result.getValue ());
> }
> }
> ----------------------------------------------------------------------------------------------------------------------------------
-----
>
> but it doesn't work because of :
> [SOAPException: faultCode=SOAP-ENV:Client; msg=No Serializer found to
> serialize a 'org.w3c.dom.Document' using encoding style "
> http://schemas.xmlsoap.org/soap/encoding/'.;
> targetException=java.lang.IllegalArgumentException: No Serializer found to
> serialize a 'org.w3c.dom.Document' using encoding style
> 'http://schemas.xmlsoap.org/soap/encoding/'.]
> at
> org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.java:224)
> at org.apache.soap.rpc.Call.invoke(Call.java:203)
> at ClientSOAP.main(ClientSOAP.java:65)
>
>
> What is the solution ?? what do I forget to do ???
>
> thank you !!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org
Re: Question about Parameters
Posted by Saint-Martin Cecile <cs...@symetrx.com>.
Try
params.addElement (new Parameter("addedfile", Element.class, docXML.getDocumentElement(),
org.apache.soap.Constants.NS_URI_LITERAL_XML));
Cecile Saint-Martin
csaintmartin@symetrx.com
----- Original Message -----
From: <ma...@cnedi69.cnafmail.fr>
To: <so...@xml.apache.org>
Sent: Tuesday, June 05, 2001 2:53 PM
Subject: Question about Parameters
> Hi,
>
> I'd like to send a service invocation to a server with any types parameter
> .... for example, I have a "XML" file, I want to parse it and constructs a
> DOM tree representation ... and I'd like to send it to a SOAP server in
> order to get the content of an element ... so I tried to send a "call" with
> one "dom.Document" parameter .... here is the client program (without catch
> etc ....):
> ----------------------------------------------------------------------------------------------------------------------------------
--------------
> String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
> URL url = new URL("http://localhost ......");
> SOAPMappingRegistry smr = new SOAPMappingRegistry();
> BeanSerializer beanSer = new BeanSerializer();
> try
> {
> Call call = new Call();
> call.setSOAPMappingRegistry(smr);
> call.setTargetObjectURI("urn:SOAP");
> call.setMethodName("Getting");
> call.setEncodingStyleURI(encodingStyleURI);
>
> DOMParser parser = new DOMParser();
> try
> {
> parser.parse("XMLFile.xml");
> }
> Document docXML = parser.getDocument();
>
> Vector params = new Vector();
> ------------------> params.addElement(new Parameter("addedfile",
> org.w3c.dom.Document.class, docXML, null));
>
> call.setParams(params);
>
> Response resp;
>
> resp = call.invoke(url, "");
>
>
> if (!resp.generatedFault ())
> {
> Parameter result = resp.getReturnValue ();
> System.out.println((String)result.getValue ());
> }
> }
> ----------------------------------------------------------------------------------------------------------------------------------
-----
>
> but it doesn't work because of :
> [SOAPException: faultCode=SOAP-ENV:Client; msg=No Serializer found to
> serialize a 'org.w3c.dom.Document' using encoding style "
> http://schemas.xmlsoap.org/soap/encoding/'.;
> targetException=java.lang.IllegalArgumentException: No Serializer found to
> serialize a 'org.w3c.dom.Document' using encoding style
> 'http://schemas.xmlsoap.org/soap/encoding/'.]
> at
> org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.java:224)
> at org.apache.soap.rpc.Call.invoke(Call.java:203)
> at ClientSOAP.main(ClientSOAP.java:65)
>
>
> What is the solution ?? what do I forget to do ???
>
> thank you !!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org