You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsif-user@ws.apache.org by Jos van den Oever <jo...@gsf.de> on 2004/08/11 11:39:23 UTC

using raw XML or mapping everything to String

Hello WSIF users,

For an application handling different types of web services, I'd like to map 
all messages to java.lang.String instances that contain the raw XML for each 
part. How can I do this?

I've tested various possibilities on a client that returns an xsd:float and 
all of them give back xsd:float as java.lang.Float.

1) Not setting the mapper in my WSIFServiceFactory or setting it to 
"org.apache.wsif.mapping.WSIFDefaultMapper".

2) Overriding WSIFMapper to map everything to "java.lang.String" and setting 
it in WSIFServiceFactory.

3) Overriding WSIFMappingConvention to map everything to "java.lang.String" 
and setting it in WSIFServiceFactory.

4) calling mapType(new QName("{http://www.w3.org/2001/XMLSchema}float"), 
String.class) on the WSIFService instance.

Can somebody point out to me what I'm doing wrong here?
The service I'm using to test this is 
http://www.xmethods.net/sd/2001/TemperatureService.wsdl which contains a soap 
binding.
Axis version: 1.1
WSIF version: current CVS

Thanks, Jos

Re: using raw XML or mapping everything to String

Posted by Jos van den Oever <jo...@gsf.de>.
Thanks for your reply, Jeff.

Accessing the WSDL content is no problem. I can do that and creating a 
Definition object is also no problem. What I want however is to have the 
input/output/fault Part content as DOM or an XML containing String.

So something like

WSIFMessage input = wsifo.createInputMessage();
WSIFMessage output = wsifo.createOutputMessage();
WSIFMessage fault = wsifo.createFaultMessage();
operation.executeRequestResponseOperation(input, output, fault);
String arg1 = output.getPartAsXML("arg1");
String arg2 = output.getPartAsXML("arg2");

Cheers, Jos

On Monday 16 August 2004 17:43, Jeff Greif wrote:
> You can use a java.net.URL for the WSDL address and any XML parser (such as
> Xerces) to produce a DOM and access what you want from it.
>
> Then, you can give the DOM Document to WSIF as one of the arguments to
> org.apache.wsif.util.WSIFUtils.readWSDL(String contextURL, Document
> wsdlDoc), which returns the Definition object and its various related
> objects representing the WSDL constructs.
>
> Jeff
> ----- Original Message -----
> From: "Jos van den Oever" <jo...@gsf.de>
> To: <ws...@ws.apache.org>
> Sent: Monday, August 16, 2004 12:57 AM
> Subject: Re: using raw XML or mapping everything to String
>
> > Hello all,
> >
> > Thanks for your reply, Alek.
> >
> > I'd like to access the DOM directly in a provider independent manner, but
> > cannot find how to get the DOM nodes corresponding to the WSDL Messages
>
> from
>
> > WSIF. Can you give me a pointer to the required functions/classes.
>
> Grepping
>
> > WSIF javadoc for 'DOM' yields nothing.
> >
> > I need to access all services dynamically.
> >
> > Best regards, Jos

Re: using raw XML or mapping everything to String

Posted by Jeff Greif <jg...@alumni.princeton.edu>.
You can use a java.net.URL for the WSDL address and any XML parser (such as
Xerces) to produce a DOM and access what you want from it.

Then, you can give the DOM Document to WSIF as one of the arguments to
org.apache.wsif.util.WSIFUtils.readWSDL(String contextURL, Document
wsdlDoc), which returns the Definition object and its various related
objects representing the WSDL constructs.

Jeff
----- Original Message ----- 
From: "Jos van den Oever" <jo...@gsf.de>
To: <ws...@ws.apache.org>
Sent: Monday, August 16, 2004 12:57 AM
Subject: Re: using raw XML or mapping everything to String


> Hello all,
>
> Thanks for your reply, Alek.
>
> I'd like to access the DOM directly in a provider independent manner, but
> cannot find how to get the DOM nodes corresponding to the WSDL Messages
from
> WSIF. Can you give me a pointer to the required functions/classes.
Grepping
> WSIF javadoc for 'DOM' yields nothing.
>
> I need to access all services dynamically.
>
> Best regards, Jos
>


Re: using raw XML or mapping everything to String

Posted by Jos van den Oever <jo...@gsf.de>.
Hello all,

Thanks for your reply, Alek.

I'd like to access the DOM directly in a provider independent manner, but 
cannot find how to get the DOM nodes corresponding to the WSDL Messages from 
WSIF. Can you give me a pointer to the required functions/classes. Grepping 
WSIF javadoc for 'DOM' yields nothing.

I need to access all services dynamically.

Best regards, Jos


On Friday 13 August 2004 21:33, Aleksander Slominski wrote:
> Jos van den Oever wrote:
> >For an application handling different types of web services, I'd like to
> > map all messages to java.lang.String instances that contain the raw XML
> > for each part. How can I do this?
>
> hi,
>
> as you are going to send actually XML i would try to use DOM Node
> instead and parse XML string into DOM node if necessary?
>
> did you try to do this?
>
> thanks,
>
> alek
>
> >I've tested various possibilities on a client that returns an xsd:float
> > and all of them give back xsd:float as java.lang.Float.
> >
> >1) Not setting the mapper in my WSIFServiceFactory or setting it to
> >"org.apache.wsif.mapping.WSIFDefaultMapper".
> >
> >2) Overriding WSIFMapper to map everything to "java.lang.String" and
> > setting it in WSIFServiceFactory.
> >
> >3) Overriding WSIFMappingConvention to map everything to
> > "java.lang.String" and setting it in WSIFServiceFactory.
> >
> >4) calling mapType(new QName("{http://www.w3.org/2001/XMLSchema}float"),
> >String.class) on the WSIFService instance.
> >
> >Can somebody point out to me what I'm doing wrong here?
> >The service I'm using to test this is
> >http://www.xmethods.net/sd/2001/TemperatureService.wsdl which contains a
> > soap binding.
> >Axis version: 1.1
> >WSIF version: current CVS
> >
> >Thanks, Jos

Re: using raw XML or mapping everything to String

Posted by Aleksander Slominski <as...@cs.indiana.edu>.
Jos van den Oever wrote:

>For an application handling different types of web services, I'd like to map 
>all messages to java.lang.String instances that contain the raw XML for each 
>part. How can I do this?
>  
>
hi,

as you are going to send actually XML i would try to use DOM Node 
instead and parse XML string into DOM node if necessary?

did you try to do this?

thanks,

alek

>I've tested various possibilities on a client that returns an xsd:float and 
>all of them give back xsd:float as java.lang.Float.
>
>1) Not setting the mapper in my WSIFServiceFactory or setting it to 
>"org.apache.wsif.mapping.WSIFDefaultMapper".
>
>2) Overriding WSIFMapper to map everything to "java.lang.String" and setting 
>it in WSIFServiceFactory.
>
>3) Overriding WSIFMappingConvention to map everything to "java.lang.String" 
>and setting it in WSIFServiceFactory.
>
>4) calling mapType(new QName("{http://www.w3.org/2001/XMLSchema}float"), 
>String.class) on the WSIFService instance.
>
>Can somebody point out to me what I'm doing wrong here?
>The service I'm using to test this is 
>http://www.xmethods.net/sd/2001/TemperatureService.wsdl which contains a soap 
>binding.
>Axis version: 1.1
>WSIF version: current CVS
>
>Thanks, Jos
>  
>


-- 
The best way to predict the future is to invent it - Alan Kay