Hi,
I've just done something similar to this, post here in case you haven't got solution.
Matthew's explanation in Apache FAQs, section "RPC response encoding styles" will help if you look thru it.
Anyway, what I have done is:
1. Set Encoding style to tell you Provider that you want to return literal as follow:
---> call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);
2. add parameter as you want to, such as String, double, ... Vector , etc. just remember to use NS_URI_SOAP_ENC
---> params.addElement(new Parameter("myVector", java.util.Vector, myVector, Constants.NS_URI_SOAP_ENC));
that is, everything else is the same as usual, you don't need to tell anything to SOAPMappingRegistry (if input parameters serializer are supported by Apache SOAP ), it is done by default thru encoding style.
hope that it helps,
cheers,
Hung
-----Original Message-----
From: Danh Hoai [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 12:23 AM
To: [EMAIL PROTECTED]
Subject: Re: How to map Element Object?
Thanks Adam,
The problem I am having is that I try to send a Vector to the server instead of Element. But I expect an Element sending back from the server. I did try to use the NS_URI_Literal_XML but the Client said something like 'I can only talk with Element'.
So, you meant if I pass an Element to the server, then I don't have to create my own Serializer/Deserializer and map them for both Client and Server??
Thanks again
Danh Hoai
----- Original Message -----
From: Adam.Leggett
To: '[EMAIL PROTECTED]'
Sent: Monday, July 09, 2001 11:46 AM
Subject: RE: How to map Element Object?
If you are just wanting to send XML Element type then why not use literal xml in the soap envelope body
ie:
Parameter inputArg =
new Parameter(
"inputXML",
Element.class,
element,
Constants.NS_URI_LITERAL_XML);
Call call = null;
call =
this.buildCall(targetURI, "createXML", this.setParams(inputArg));
call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);
this.outputResult(call.invoke(url, ""),"createXML");
Hope this helps,
Adam
-----Original Message-----
From: Danh Hoai [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 09, 2001 4:11 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: How to map Element Object?
Thanks Kanq,
I tried to use BeanSerializer as you said. But now I have different message as following:
SOAPException : SOAP-ENV:Client Unable to instantiate 'org.w3c.dom.Element': org/w3c/dom/Element
At the client side I try to map as following:
SOAPMappingRegistry smr = new SOAPMappingRegistry();
BeanSerializer beanSer = new BeanSerializer();
// Map the types.
smr.mapTypes(Constants.NS_URI_SOAP_ENC,
new QName("urn:xml-soap-address-demo", "address"),
Element.class, beanSer, beanSer);
Call call = new Call();
call.setSOAPMappingRegistry(smr);
call.setTargetObjectURI(urn);
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
call.setMethodName("createXML");
Vector parameters = new Vector();
Vector data = new Vector();
...
...
At the server end point to pass back to the client an Element document.
Anyone has any ideas, please help me.
Thank you for your help.
Danh Hoai
>I think you are supposed to use the Message object from the client. If
>you really want to serialize a Message object I would use the BeanSerializer
>class (if Message is a java bean) or write your own.
>You might want to look at the GetAddress.java example in samples.addressbook
>package for how to use the BeanSerializer class.
