You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by Octav Chipara <oc...@cse.unl.edu> on 2000/07/06 19:43:38 UTC

HELP - when my service returns an domElement


HI!


I have been playing around with the SOAP. I'm trying to develop a web
service and I did not have much success. I was able to get my service to
work when it returns a java class but when I try to return an Element I
have a java exception telling the it cannot instantiate the
org.w3c.domElement. I guess that it has to do something with the mapping
but now I'm a little bit lost... Do you guys have any ideas.


Thanks,
Octav


******************************************************************************
e-mail:         ochipara@cse.unl.edu
phone:		(402)472-9492
web page:	www.cse.unl.edu/~ochipara
******************************************************************************


Re: HELP - when my service returns an domElement

Posted by Lutz Wischmann <wi...@ems.guj.de>.
Octav Chipara wrote:
> service and I did not have much success. I was able to get my service to
> work when it returns a java class but when I try to return an Element I
> have a java exception telling the it cannot instantiate the
> org.w3c.domElement. I guess that it has to do something with the mapping
> but now I'm a little bit lost... Do you guys have any ideas.

Hi,

you have to make sure that you mapped your return type correctly to
NS_URI_LITERAL_XML. Just have a look at the GetAddress - Sample, which
in fact handles XML Elements. 
   
	// Build the call.
    Call call = new Call ();
    call.setTargetObjectURI ("urn:ems-clp-profile");
    call.setMethodName (op);
    call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML); // this is
the magic...
    Vector params = new Vector ();
    params.addElement (...);
    call.setParams (params);
    
    Response resp = call.invoke (/* router URL */ url, /* actionURI */
"" );
    
    Parameter result = resp.getReturnValue ();
    Element siteProfile = (Element)result.getValue();

Lutz

Re: HELP - when my service returns an domElement

Posted by Lutz Wischmann <wi...@ems.guj.de>.
Octav Chipara wrote:
> service and I did not have much success. I was able to get my service to
> work when it returns a java class but when I try to return an Element I
> have a java exception telling the it cannot instantiate the
> org.w3c.domElement. I guess that it has to do something with the mapping
> but now I'm a little bit lost... Do you guys have any ideas.

Hi,

you have to make sure that you mapped your return type correctly to
NS_URI_LITERAL_XML. Just have a look at the GetAddress - Sample, which
in fact handles XML Elements. 
   
	// Build the call.
    Call call = new Call ();
    call.setTargetObjectURI ("urn:ems-clp-profile");
    call.setMethodName (op);
    call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML); // this is
the magic...
    Vector params = new Vector ();
    params.addElement (...);
    call.setParams (params);
    
    Response resp = call.invoke (/* router URL */ url, /* actionURI */
"" );
    
    Parameter result = resp.getReturnValue ();
    Element siteProfile = (Element)result.getValue();

Lutz