Hi Chris,
I think you should add namespace by your hand,
if you use RawXMLINOutMessageReceiver.
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs =
fac.createOMNamespace("http://cbare.org/books-ws/", "ns");
OMElement payload = fac.createOMElement("findAuthors", omNs);
OMElement firstName = fac.createOMElement("firstName", omNs);
firstName.setText("Bob");
OMElement lastName = fac.createOMElement("lastName", omNs);
lastName.setText("Smith");
payload.addChild(firstName);
payload.addChild(lastName);
--- Christopher Bare <[EMAIL PROTECTED]> wrote:
>
> I'm having a problem with the REST feature of Axis2. I hacked up a
> WSDL which specifies a "findAuthors" method. I use
> RawXMLINOutMessageReceiver so, on the Java side, the method looks
> like this:
>
> public OMElement findAuthors(OMElement parameters);
>
> This method works fine when I call it from SOAP. It gets a SOAP body
> that looks like this:
>
>
> <firstName>Bob</firstName>
> <lastName>Smith</lastName>
> </findAuthors>
>
> Totally cool... But, calling it through the REST method with the URL:
>
>
http://localhost:8080/axis2/rest/books/findAuthors?firstName=Bob&lastName=Smith
>
> Results in this OMElement:
>
>
> <firstName>Bob</firstName>
> <lastName>Smith</lastName>
> </axis2ns3:findAuthors>
>
> This fails because the firstName and lastName elements are in the
> wrong namespace. They need to be in the "http://cbare.org/books-ws/"
> namespace and they're not.
>
> I guess calling a RawXML method using REST might be a nutty thing to
> want to do. But leaving that aside, is there a problem with the way
> the framework generates XML from a REST request? Or am I using it
> wrong? The REST binding for that method looks like this:
>
> <wsdl:binding name="booksHttpBinding" type="cbws:booksPortType">
> <http:binding verb="POST"/>
> <wsdl:operation name="findAuthors">
> <http:operation location="findAuthors"/>
> <wsdl:input>
> <mime:content type="text/xml"/>
> </wsdl:input>
> <wsdl:output>
> <mime:content type="text/xml"/>
> </wsdl:output>
> </wsdl:operation>
> ...
> </wsdl:binding>
>
> Is there something I need to tweak in here to let clue it in about
> the namespaces?
>
> Finally, for good measure, the WSDL type definition looks like this:
>
>
> elementFormDefault="qualified">
>
> <xsd:element name="findAuthors">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="firstName" type="xsd:string"
> nillable="true" minOccurs="0" maxOccurs="1"/>
> <xsd:element name="lastName" type="xsd:string"
> minOccurs="1" maxOccurs="1"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> ...
>
> I'm using: Apache Axis2 1.1-SNAPSHOT build (October 31 2006), just in
> case that matters. Thanks for any hints,
>
> - Chris
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
____________________________________________________________________________________
Sponsored Link
Mortgage rates near 39yr lows.
$420k for $1,399/mo. Calculate new payment!
www.LowerMyBills.com/lre
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]