You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Rich Adili <Ri...@xata.com> on 2007/03/16 14:45:45 UTC

Embedding XML into SOAP

I'm writing a client for a service that takes an XML document as input.
I'm using WSDL2Java-generated code for my client. The generated code
wants an OMElement for the XML data. This snippet attempts to supply
that. Clearly, it ain't right as the send throws an exception. What am I
doing wrong?

	public void testme(final InputStream xmlStream) throws Exception
	{
		DispatchImportServiceStub stub = new
DispatchImportServiceStub();
		DispatchImportServiceStub.ImportTripPlan dataObject =
				new
DispatchImportServiceStub.ImportTripPlan();
		DispatchImportServiceStub.Plan_type0 Plan = new
DispatchImportServiceStub.Plan_type0();
		XMLStreamReader parser =
XMLInputFactory.newInstance().createXMLStreamReader(xmlStream);
		StAXOMBuilder builder = new StAXOMBuilder(parser);
		OMElement documentElement =
builder.getDocumentElement();
		Plan.setExtraElement(documentElement);
		dataObject.setPlan(Plan);
		stub.ImportTripPlan(dataObject);
	}

org.apache.axis2.AxisFault: Error in extracting message properties;
nested exception is: 
	org.apache.rampart.RampartException: Error in extracting message
properties
	at
org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65)
	at org.apache.axis2.engine.Phase.invoke(Phase.java:382)
	at
org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:522)
	at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:655)
	at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOper
ation.java:237)
	at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisO
peration.java:202)
	at
net.xatanet.axisstubs.DispatchImportServiceStub.ImportTripPlan(DispatchI
mportServiceStub.java:141)
	at
net.xatanet.services.DispatchImportService.ImportTripPlan(DispatchImport
Service.java:82)
	at test.TestImportTripPlan.run(TestImportTripPlan.java:33)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at test.GUI$2$1.run(GUI.java:97)
	at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.rampart.RampartException: Error in extracting
message properties
	at
org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:294
)
	at
org.apache.rampart.MessageBuilder.build(MessageBuilder.java:56)
	at
org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:59)
	... 14 more
Caused by: org.apache.ws.security.WSSecurityException: Error in
converting SOAP Envelope to Document; nested exception is: 
	org.apache.axiom.om.OMException:
javax.xml.stream.XMLStreamException: org.apache.axiom.om.OMException:
Parser has already reached end of the document. No siblings found
	at
org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.
java:121)
	at
org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:146
)
	... 16 more
Caused by: org.apache.axiom.om.OMException:
javax.xml.stream.XMLStreamException: org.apache.axiom.om.OMException:
Parser has already reached end of the document. No siblings found
	at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:1
99)
	at
org.apache.axiom.om.impl.dom.NodeImpl.build(NodeImpl.java:469)
	at
org.apache.axiom.om.impl.dom.DocumentImpl.build(DocumentImpl.java:476)
	at
org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.
java:107)
	... 17 more
Caused by: javax.xml.stream.XMLStreamException:
org.apache.axiom.om.OMException: Parser has already reached end of the
document. No siblings found
	at
org.apache.axiom.om.impl.llom.OMStAXWrapper.updateLastNode(OMStAXWrapper
.java:952)
	at
org.apache.axiom.om.impl.llom.OMStAXWrapper.next(OMStAXWrapper.java:913)
	at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:1
16)
	... 20 more
Caused by: org.apache.axiom.om.OMException: Parser has already reached
end of the document. No siblings found
	at
org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementIm
pl.java:269)
	at
org.apache.axiom.om.impl.llom.OMNavigator._getFirstChild(OMNavigator.jav
a:159)
	at
org.apache.axiom.om.impl.llom.OMNavigator.updateNextNode(OMNavigator.jav
a:128)
	at
org.apache.axiom.om.impl.llom.OMNavigator.next(OMNavigator.java:109)
	at
org.apache.axiom.om.impl.llom.OMStAXWrapper.updateNextNode(OMStAXWrapper
.java:961)
	at
org.apache.axiom.om.impl.llom.OMStAXWrapper.updateLastNode(OMStAXWrapper
.java:950)
	... 22 more

Re: Embedding XML into SOAP

Posted by Paul Fremantle <pz...@gmail.com>.
hmmmm I don't see anything obviously wrong in what you are doing. Have
you tried upping your log4j debug level.

Paul


On 3/16/07, Rich Adili <Ri...@xata.com> wrote:
> OKEEDOKEE.
>
> <?xml version="1.0" encoding="utf-8"?>
> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
> xmlns:tns="http://www.xatanet.net/XataNetWebService/DispatchImportServic
> e" xmlns:s="http://www.w3.org/2001/XMLSchema"
> xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
> xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
> targetNamespace="http://www.xatanet.net/XataNetWebService/DispatchImport
> Service" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
>   <wsdl:types>
>     <s:schema elementFormDefault="qualified"
> targetNamespace="http://www.xatanet.net/XataNetWebService/DispatchImport
> Service">
>       <s:element name="ImportTripPlan">
>         <s:complexType>
>           <s:sequence>
>             <s:element minOccurs="0" maxOccurs="1" name="plan">
>               <s:complexType mixed="true">
>                 <s:sequence>
>                   <s:any />
>                 </s:sequence>
>               </s:complexType>
>             </s:element>
>           </s:sequence>
>         </s:complexType>
>       </s:element>
>       <s:element name="ImportTripPlanResponse">
>         <s:complexType>
>           <s:sequence>
>             <s:element minOccurs="0" maxOccurs="1"
> name="ImportTripPlanResult" type="s:string" />
>           </s:sequence>
>         </s:complexType>
>       </s:element>
>     </s:schema>
>   </wsdl:types>
>   <wsdl:message name="ImportTripPlanSoapIn">
>     <wsdl:part name="parameters" element="tns:ImportTripPlan" />
>   </wsdl:message>
>   <wsdl:message name="ImportTripPlanSoapOut">
>     <wsdl:part name="parameters" element="tns:ImportTripPlanResponse" />
>   </wsdl:message>
>   <wsdl:portType name="DispatchImportServiceSoap">
>     <wsdl:operation name="ImportTripPlan">
>       <wsdl:documentation
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Adds a single trip plan
> to the XataNet system.  &lt;BR&gt;The input parameter, plan, must be an
> XmlDocument conforming to the XataNet &lt;a
> href=/XataNetWebService/MessageSchemas/SchemaDocumentation/TripPlan/Trip
> Plan.html&gt;TripPlan.xsd&lt;/a&gt;&lt;BR&gt;</wsdl:documentation>
>       <wsdl:input message="tns:ImportTripPlanSoapIn" />
>       <wsdl:output message="tns:ImportTripPlanSoapOut" />
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:binding name="DispatchImportServiceSoap"
> type="tns:DispatchImportServiceSoap">
>     <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
>     <wsdl:operation name="ImportTripPlan">
>       <soap:operation
> soapAction="http://www.xatanet.net/XataNetWebService/DispatchImportServi
> ce/ImportTripPlan" style="document" />
>       <wsdl:input>
>         <soap:body use="literal" />
>       </wsdl:input>
>       <wsdl:output>
>         <soap:body use="literal" />
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:binding name="DispatchImportServiceSoap12"
> type="tns:DispatchImportServiceSoap">
>     <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
>     <wsdl:operation name="ImportTripPlan">
>       <soap12:operation
> soapAction="http://www.xatanet.net/XataNetWebService/DispatchImportServi
> ce/ImportTripPlan" style="document" />
>       <wsdl:input>
>         <soap12:body use="literal" />
>       </wsdl:input>
>       <wsdl:output>
>         <soap12:body use="literal" />
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:service name="DispatchImportService">
>     <wsdl:port name="DispatchImportServiceSoap"
> binding="tns:DispatchImportServiceSoap">
>       <soap:address
> location="http://alpha.xata.com/xatanetwebservice/DispatchImportService.
> asmx" />
>     </wsdl:port>
>     <wsdl:port name="DispatchImportServiceSoap12"
> binding="tns:DispatchImportServiceSoap12">
>       <soap12:address
> location="http://alpha.xata.com/xatanetwebservice/DispatchImportService.
> asmx" />
>     </wsdl:port>
>   </wsdl:service>
> </wsdl:definitions>
>
> -----Original Message-----
> From: Paul Fremantle [mailto:pzfreo@gmail.com]
> Sent: Friday, March 16, 2007 11:38 AM
> To: axis-user@ws.apache.org
> Subject: Re: Embedding XML into SOAP
>
> Rich
>
> Can you let us see the WSDL? I don't understand the usecase.
>
> Paul
>
> On 3/16/07, Rich Adili <Ri...@xata.com> wrote:
> > Thanks for the suggestions, Paul. I tried the nodatabinding approach
> and
> > it got me past my original problem. Unfortunately, both suggested
> > approaches return an OMElement and I have 48 web methods to implement.
> > I'm not keen on writing that much unwrapping code.
> >
> > So, can someone tell me what I did wrong in the first place?
> >
> > -----Original Message-----
> > From: Paul Fremantle [mailto:pzfreo@gmail.com]
> > Sent: Friday, March 16, 2007 8:57 AM
> > To: axis-user@ws.apache.org
> > Subject: Re: Embedding XML into SOAP
> >
> > Rich
> >
> > Is the XML the whole of the SOAP body? Because its much simpler to use
> > the ServiceClient API which takes an OMElement directly.
> >
> > ServiceClient sc = new ServiceClient(url);
> > // if the service needs an action:
> > sc.getOptions().setAction("http://whatever");
> > OMElement response = sc.sendReceive(omElement);
> >
> > The other option is to generate the stub using the nodatabinding
> > approach which will mean you don't have all those classes.
> >
> > Try wsdl2java -d none
> >
> > Paul
> >
> > On 3/16/07, Rich Adili <Ri...@xata.com> wrote:
> > >
> > >
> > >
> > > I'm writing a client for a service that takes an XML document as
> > input. I'm
> > > using WSDL2Java-generated code for my client. The generated code
> wants
> > an
> > > OMElement for the XML data. This snippet attempts to supply that.
> > Clearly,
> > > it ain't right as the send throws an exception. What am I doing
> wrong?
> > >
> > >
> > >
> > >         public void testme(final InputStream xmlStream) throws
> > Exception
> > >
> > >         {
> > >
> > >                 DispatchImportServiceStub stub = new
> > > DispatchImportServiceStub();
> > >
> > >                 DispatchImportServiceStub.ImportTripPlan
> > > dataObject =
> > >
> > >                                 new
> > > DispatchImportServiceStub.ImportTripPlan();
> > >
> > >                 DispatchImportServiceStub.Plan_type0 Plan =
> > > new DispatchImportServiceStub.Plan_type0();
> > >
> > >                 XMLStreamReader parser =
> > > XMLInputFactory.newInstance().createXMLStreamReader(xmlStream);
> > >
> > >                 StAXOMBuilder builder = new StAXOMBuilder(parser);
> > >
> > >                 OMElement documentElement =
> > builder.getDocumentElement();
> > >
> > >                 Plan.setExtraElement(documentElement);
> > >
> > >                 dataObject.setPlan(Plan);
> > >
> > >                 stub.ImportTripPlan(dataObject);
> > >
> > >         }
> > >
> > >
> > >
> > > org.apache.axis2.AxisFault: Error in extracting message properties;
> > nested
> > > exception is:
> > >
> > >         org.apache.rampart.RampartException: Error in
> > > extracting message properties
> > >
> > >         at
> > >
> org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65)
> > >
> > >         at
> > > org.apache.axis2.engine.Phase.invoke(Phase.java:382)
> > >
> > >         at
> > > org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:522)
> > >
> > >         at
> > > org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:655)
> > >
> > >         at
> > >
> >
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOper
> > ation.java:237)
> > >
> > >         at
> > >
> >
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisO
> > peration.java:202)
> > >
> > >         at
> > >
> >
> net.xatanet.axisstubs.DispatchImportServiceStub.ImportTripPlan(DispatchI
> > mportServiceStub.java:141)
> > >
> > >         at
> > >
> >
> net.xatanet.services.DispatchImportService.ImportTripPlan(DispatchImport
> > Service.java:82)
> > >
> > >         at test.TestImportTripPlan.run(TestImportTripPlan.java:33)
> > >
> > >         at
> > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >
> > >         at
> > >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> > a:39)
> > >
> > >         at
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> > Impl.java:25)
> > >
> > >         at java.lang.reflect.Method.invoke(Method.java:597)
> > >
> > >         at test.GUI$2$1.run(GUI.java:97)
> > >
> > >         at java.lang.Thread.run(Thread.java:619)
> > >
> > > Caused by: org.apache.rampart.RampartException: Error in
> > > extracting message properties
> > >
> > >         at
> > >
> >
> org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:294
> > )
> > >
> > >         at
> > > org.apache.rampart.MessageBuilder.build(MessageBuilder.java:56)
> > >
> > >         at
> > >
> org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:59)
> > >
> > >         ... 14 more
> > >
> > > Caused by: org.apache.ws.security.WSSecurityException:
> > > Error in converting SOAP Envelope to Document; nested exception is:
> > >
> > >         org.apache.axiom.om.OMException:
> > > javax.xml.stream.XMLStreamException:
> > > org.apache.axiom.om.OMException: Parser has already reached end of
> the
> > > document. No siblings found
> > >
> > >         at
> > >
> >
> org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.
> > java:121)
> > >
> > >         at
> > >
> >
> org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:146
> > )
> > >
> > >         ... 16 more
> > >
> > > Caused by: org.apache.axiom.om.OMException:
> > > javax.xml.stream.XMLStreamException:
> > > org.apache.axiom.om.OMException: Parser has already reached end of
> the
> > > document. No siblings found
> > >
> > >         at
> > >
> >
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:1
> > 99)
> > >
> > >         at
> > > org.apache.axiom.om.impl.dom.NodeImpl.build(NodeImpl.java:469)
> > >
> > >         at
> > >
> org.apache.axiom.om.impl.dom.DocumentImpl.build(DocumentImpl.java:476)
> > >
> > >         at
> > >
> >
> org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.
> > java:107)
> > >
> > >         ... 17 more
> > >
> > > Caused by: javax.xml.stream.XMLStreamException:
> > > org.apache.axiom.om.OMException: Parser has already reached end of
> the
> > > document. No siblings found
> > >
> > >         at
> > >
> >
> org.apache.axiom.om.impl.llom.OMStAXWrapper.updateLastNode(OMStAXWrapper
> > .java:952)
> > >
> > >         at
> > >
> >
> org.apache.axiom.om.impl.llom.OMStAXWrapper.next(OMStAXWrapper.java:913)
> > >
> > >         at
> > >
> >
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:1
> > 16)
> > >
> > >         ... 20 more
> > >
> > > Caused by: org.apache.axiom.om.OMException: Parser has already
> reached
> > end
> > > of the document. No siblings found
> > >
> > >         at
> > >
> >
> org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementIm
> > pl.java:269)
> > >
> > >         at
> > >
> >
> org.apache.axiom.om.impl.llom.OMNavigator._getFirstChild(OMNavigator.jav
> > a:159)
> > >
> > >         at
> > >
> >
> org.apache.axiom.om.impl.llom.OMNavigator.updateNextNode(OMNavigator.jav
> > a:128)
> > >
> > >         at
> > > org.apache.axiom.om.impl.llom.OMNavigator.next(OMNavigator.java:109)
> > >
> > >         at
> > >
> >
> org.apache.axiom.om.impl.llom.OMStAXWrapper.updateNextNode(OMStAXWrapper
> > .java:961)
> > >
> > >         at
> > >
> >
> org.apache.axiom.om.impl.llom.OMStAXWrapper.updateLastNode(OMStAXWrapper
> > .java:950)
> > >
> > >         ... 22 more
> >
> >
> > --
> > Paul Fremantle
> > VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
> >
> > http://bloglines.com/blog/paulfremantle
> > paul@wso2.com
> >
> > "Oxygenating the Web Service Platform", www.wso2.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
> --
> Paul Fremantle
> VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
>
> http://bloglines.com/blog/paulfremantle
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Paul Fremantle
VP/Technology, WSO2 and OASIS WS-RX TC Co-chair

http://bloglines.com/blog/paulfremantle
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: Embedding XML into SOAP

Posted by Rich Adili <Ri...@xata.com>.
OKEEDOKEE.

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://www.xatanet.net/XataNetWebService/DispatchImportServic
e" xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://www.xatanet.net/XataNetWebService/DispatchImport
Service" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified"
targetNamespace="http://www.xatanet.net/XataNetWebService/DispatchImport
Service">
      <s:element name="ImportTripPlan">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="plan">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="ImportTripPlanResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1"
name="ImportTripPlanResult" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="ImportTripPlanSoapIn">
    <wsdl:part name="parameters" element="tns:ImportTripPlan" />
  </wsdl:message>
  <wsdl:message name="ImportTripPlanSoapOut">
    <wsdl:part name="parameters" element="tns:ImportTripPlanResponse" />
  </wsdl:message>
  <wsdl:portType name="DispatchImportServiceSoap">
    <wsdl:operation name="ImportTripPlan">
      <wsdl:documentation
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Adds a single trip plan
to the XataNet system.  &lt;BR&gt;The input parameter, plan, must be an
XmlDocument conforming to the XataNet &lt;a
href=/XataNetWebService/MessageSchemas/SchemaDocumentation/TripPlan/Trip
Plan.html&gt;TripPlan.xsd&lt;/a&gt;&lt;BR&gt;</wsdl:documentation>
      <wsdl:input message="tns:ImportTripPlanSoapIn" />
      <wsdl:output message="tns:ImportTripPlanSoapOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="DispatchImportServiceSoap"
type="tns:DispatchImportServiceSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="ImportTripPlan">
      <soap:operation
soapAction="http://www.xatanet.net/XataNetWebService/DispatchImportServi
ce/ImportTripPlan" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="DispatchImportServiceSoap12"
type="tns:DispatchImportServiceSoap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="ImportTripPlan">
      <soap12:operation
soapAction="http://www.xatanet.net/XataNetWebService/DispatchImportServi
ce/ImportTripPlan" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="DispatchImportService">
    <wsdl:port name="DispatchImportServiceSoap"
binding="tns:DispatchImportServiceSoap">
      <soap:address
location="http://alpha.xata.com/xatanetwebservice/DispatchImportService.
asmx" />
    </wsdl:port>
    <wsdl:port name="DispatchImportServiceSoap12"
binding="tns:DispatchImportServiceSoap12">
      <soap12:address
location="http://alpha.xata.com/xatanetwebservice/DispatchImportService.
asmx" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

-----Original Message-----
From: Paul Fremantle [mailto:pzfreo@gmail.com] 
Sent: Friday, March 16, 2007 11:38 AM
To: axis-user@ws.apache.org
Subject: Re: Embedding XML into SOAP

Rich

Can you let us see the WSDL? I don't understand the usecase.

Paul

On 3/16/07, Rich Adili <Ri...@xata.com> wrote:
> Thanks for the suggestions, Paul. I tried the nodatabinding approach
and
> it got me past my original problem. Unfortunately, both suggested
> approaches return an OMElement and I have 48 web methods to implement.
> I'm not keen on writing that much unwrapping code.
>
> So, can someone tell me what I did wrong in the first place?
>
> -----Original Message-----
> From: Paul Fremantle [mailto:pzfreo@gmail.com]
> Sent: Friday, March 16, 2007 8:57 AM
> To: axis-user@ws.apache.org
> Subject: Re: Embedding XML into SOAP
>
> Rich
>
> Is the XML the whole of the SOAP body? Because its much simpler to use
> the ServiceClient API which takes an OMElement directly.
>
> ServiceClient sc = new ServiceClient(url);
> // if the service needs an action:
> sc.getOptions().setAction("http://whatever");
> OMElement response = sc.sendReceive(omElement);
>
> The other option is to generate the stub using the nodatabinding
> approach which will mean you don't have all those classes.
>
> Try wsdl2java -d none
>
> Paul
>
> On 3/16/07, Rich Adili <Ri...@xata.com> wrote:
> >
> >
> >
> > I'm writing a client for a service that takes an XML document as
> input. I'm
> > using WSDL2Java-generated code for my client. The generated code
wants
> an
> > OMElement for the XML data. This snippet attempts to supply that.
> Clearly,
> > it ain't right as the send throws an exception. What am I doing
wrong?
> >
> >
> >
> >         public void testme(final InputStream xmlStream) throws
> Exception
> >
> >         {
> >
> >                 DispatchImportServiceStub stub = new
> > DispatchImportServiceStub();
> >
> >                 DispatchImportServiceStub.ImportTripPlan
> > dataObject =
> >
> >                                 new
> > DispatchImportServiceStub.ImportTripPlan();
> >
> >                 DispatchImportServiceStub.Plan_type0 Plan =
> > new DispatchImportServiceStub.Plan_type0();
> >
> >                 XMLStreamReader parser =
> > XMLInputFactory.newInstance().createXMLStreamReader(xmlStream);
> >
> >                 StAXOMBuilder builder = new StAXOMBuilder(parser);
> >
> >                 OMElement documentElement =
> builder.getDocumentElement();
> >
> >                 Plan.setExtraElement(documentElement);
> >
> >                 dataObject.setPlan(Plan);
> >
> >                 stub.ImportTripPlan(dataObject);
> >
> >         }
> >
> >
> >
> > org.apache.axis2.AxisFault: Error in extracting message properties;
> nested
> > exception is:
> >
> >         org.apache.rampart.RampartException: Error in
> > extracting message properties
> >
> >         at
> >
org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65)
> >
> >         at
> > org.apache.axis2.engine.Phase.invoke(Phase.java:382)
> >
> >         at
> > org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:522)
> >
> >         at
> > org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:655)
> >
> >         at
> >
>
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOper
> ation.java:237)
> >
> >         at
> >
>
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisO
> peration.java:202)
> >
> >         at
> >
>
net.xatanet.axisstubs.DispatchImportServiceStub.ImportTripPlan(DispatchI
> mportServiceStub.java:141)
> >
> >         at
> >
>
net.xatanet.services.DispatchImportService.ImportTripPlan(DispatchImport
> Service.java:82)
> >
> >         at test.TestImportTripPlan.run(TestImportTripPlan.java:33)
> >
> >         at
> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >
> >         at
> >
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
> >
> >         at
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
> >
> >         at java.lang.reflect.Method.invoke(Method.java:597)
> >
> >         at test.GUI$2$1.run(GUI.java:97)
> >
> >         at java.lang.Thread.run(Thread.java:619)
> >
> > Caused by: org.apache.rampart.RampartException: Error in
> > extracting message properties
> >
> >         at
> >
>
org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:294
> )
> >
> >         at
> > org.apache.rampart.MessageBuilder.build(MessageBuilder.java:56)
> >
> >         at
> >
org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:59)
> >
> >         ... 14 more
> >
> > Caused by: org.apache.ws.security.WSSecurityException:
> > Error in converting SOAP Envelope to Document; nested exception is:
> >
> >         org.apache.axiom.om.OMException:
> > javax.xml.stream.XMLStreamException:
> > org.apache.axiom.om.OMException: Parser has already reached end of
the
> > document. No siblings found
> >
> >         at
> >
>
org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.
> java:121)
> >
> >         at
> >
>
org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:146
> )
> >
> >         ... 16 more
> >
> > Caused by: org.apache.axiom.om.OMException:
> > javax.xml.stream.XMLStreamException:
> > org.apache.axiom.om.OMException: Parser has already reached end of
the
> > document. No siblings found
> >
> >         at
> >
>
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:1
> 99)
> >
> >         at
> > org.apache.axiom.om.impl.dom.NodeImpl.build(NodeImpl.java:469)
> >
> >         at
> >
org.apache.axiom.om.impl.dom.DocumentImpl.build(DocumentImpl.java:476)
> >
> >         at
> >
>
org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.
> java:107)
> >
> >         ... 17 more
> >
> > Caused by: javax.xml.stream.XMLStreamException:
> > org.apache.axiom.om.OMException: Parser has already reached end of
the
> > document. No siblings found
> >
> >         at
> >
>
org.apache.axiom.om.impl.llom.OMStAXWrapper.updateLastNode(OMStAXWrapper
> .java:952)
> >
> >         at
> >
>
org.apache.axiom.om.impl.llom.OMStAXWrapper.next(OMStAXWrapper.java:913)
> >
> >         at
> >
>
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:1
> 16)
> >
> >         ... 20 more
> >
> > Caused by: org.apache.axiom.om.OMException: Parser has already
reached
> end
> > of the document. No siblings found
> >
> >         at
> >
>
org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementIm
> pl.java:269)
> >
> >         at
> >
>
org.apache.axiom.om.impl.llom.OMNavigator._getFirstChild(OMNavigator.jav
> a:159)
> >
> >         at
> >
>
org.apache.axiom.om.impl.llom.OMNavigator.updateNextNode(OMNavigator.jav
> a:128)
> >
> >         at
> > org.apache.axiom.om.impl.llom.OMNavigator.next(OMNavigator.java:109)
> >
> >         at
> >
>
org.apache.axiom.om.impl.llom.OMStAXWrapper.updateNextNode(OMStAXWrapper
> .java:961)
> >
> >         at
> >
>
org.apache.axiom.om.impl.llom.OMStAXWrapper.updateLastNode(OMStAXWrapper
> .java:950)
> >
> >         ... 22 more
>
>
> --
> Paul Fremantle
> VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
>
> http://bloglines.com/blog/paulfremantle
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Paul Fremantle
VP/Technology, WSO2 and OASIS WS-RX TC Co-chair

http://bloglines.com/blog/paulfremantle
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Embedding XML into SOAP

Posted by Paul Fremantle <pz...@gmail.com>.
Rich

Can you let us see the WSDL? I don't understand the usecase.

Paul

On 3/16/07, Rich Adili <Ri...@xata.com> wrote:
> Thanks for the suggestions, Paul. I tried the nodatabinding approach and
> it got me past my original problem. Unfortunately, both suggested
> approaches return an OMElement and I have 48 web methods to implement.
> I'm not keen on writing that much unwrapping code.
>
> So, can someone tell me what I did wrong in the first place?
>
> -----Original Message-----
> From: Paul Fremantle [mailto:pzfreo@gmail.com]
> Sent: Friday, March 16, 2007 8:57 AM
> To: axis-user@ws.apache.org
> Subject: Re: Embedding XML into SOAP
>
> Rich
>
> Is the XML the whole of the SOAP body? Because its much simpler to use
> the ServiceClient API which takes an OMElement directly.
>
> ServiceClient sc = new ServiceClient(url);
> // if the service needs an action:
> sc.getOptions().setAction("http://whatever");
> OMElement response = sc.sendReceive(omElement);
>
> The other option is to generate the stub using the nodatabinding
> approach which will mean you don't have all those classes.
>
> Try wsdl2java -d none
>
> Paul
>
> On 3/16/07, Rich Adili <Ri...@xata.com> wrote:
> >
> >
> >
> > I'm writing a client for a service that takes an XML document as
> input. I'm
> > using WSDL2Java-generated code for my client. The generated code wants
> an
> > OMElement for the XML data. This snippet attempts to supply that.
> Clearly,
> > it ain't right as the send throws an exception. What am I doing wrong?
> >
> >
> >
> >         public void testme(final InputStream xmlStream) throws
> Exception
> >
> >         {
> >
> >                 DispatchImportServiceStub stub = new
> > DispatchImportServiceStub();
> >
> >                 DispatchImportServiceStub.ImportTripPlan
> > dataObject =
> >
> >                                 new
> > DispatchImportServiceStub.ImportTripPlan();
> >
> >                 DispatchImportServiceStub.Plan_type0 Plan =
> > new DispatchImportServiceStub.Plan_type0();
> >
> >                 XMLStreamReader parser =
> > XMLInputFactory.newInstance().createXMLStreamReader(xmlStream);
> >
> >                 StAXOMBuilder builder = new StAXOMBuilder(parser);
> >
> >                 OMElement documentElement =
> builder.getDocumentElement();
> >
> >                 Plan.setExtraElement(documentElement);
> >
> >                 dataObject.setPlan(Plan);
> >
> >                 stub.ImportTripPlan(dataObject);
> >
> >         }
> >
> >
> >
> > org.apache.axis2.AxisFault: Error in extracting message properties;
> nested
> > exception is:
> >
> >         org.apache.rampart.RampartException: Error in
> > extracting message properties
> >
> >         at
> > org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65)
> >
> >         at
> > org.apache.axis2.engine.Phase.invoke(Phase.java:382)
> >
> >         at
> > org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:522)
> >
> >         at
> > org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:655)
> >
> >         at
> >
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOper
> ation.java:237)
> >
> >         at
> >
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisO
> peration.java:202)
> >
> >         at
> >
> net.xatanet.axisstubs.DispatchImportServiceStub.ImportTripPlan(DispatchI
> mportServiceStub.java:141)
> >
> >         at
> >
> net.xatanet.services.DispatchImportService.ImportTripPlan(DispatchImport
> Service.java:82)
> >
> >         at test.TestImportTripPlan.run(TestImportTripPlan.java:33)
> >
> >         at
> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >
> >         at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
> >
> >         at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
> >
> >         at java.lang.reflect.Method.invoke(Method.java:597)
> >
> >         at test.GUI$2$1.run(GUI.java:97)
> >
> >         at java.lang.Thread.run(Thread.java:619)
> >
> > Caused by: org.apache.rampart.RampartException: Error in
> > extracting message properties
> >
> >         at
> >
> org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:294
> )
> >
> >         at
> > org.apache.rampart.MessageBuilder.build(MessageBuilder.java:56)
> >
> >         at
> > org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:59)
> >
> >         ... 14 more
> >
> > Caused by: org.apache.ws.security.WSSecurityException:
> > Error in converting SOAP Envelope to Document; nested exception is:
> >
> >         org.apache.axiom.om.OMException:
> > javax.xml.stream.XMLStreamException:
> > org.apache.axiom.om.OMException: Parser has already reached end of the
> > document. No siblings found
> >
> >         at
> >
> org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.
> java:121)
> >
> >         at
> >
> org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:146
> )
> >
> >         ... 16 more
> >
> > Caused by: org.apache.axiom.om.OMException:
> > javax.xml.stream.XMLStreamException:
> > org.apache.axiom.om.OMException: Parser has already reached end of the
> > document. No siblings found
> >
> >         at
> >
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:1
> 99)
> >
> >         at
> > org.apache.axiom.om.impl.dom.NodeImpl.build(NodeImpl.java:469)
> >
> >         at
> > org.apache.axiom.om.impl.dom.DocumentImpl.build(DocumentImpl.java:476)
> >
> >         at
> >
> org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.
> java:107)
> >
> >         ... 17 more
> >
> > Caused by: javax.xml.stream.XMLStreamException:
> > org.apache.axiom.om.OMException: Parser has already reached end of the
> > document. No siblings found
> >
> >         at
> >
> org.apache.axiom.om.impl.llom.OMStAXWrapper.updateLastNode(OMStAXWrapper
> .java:952)
> >
> >         at
> >
> org.apache.axiom.om.impl.llom.OMStAXWrapper.next(OMStAXWrapper.java:913)
> >
> >         at
> >
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:1
> 16)
> >
> >         ... 20 more
> >
> > Caused by: org.apache.axiom.om.OMException: Parser has already reached
> end
> > of the document. No siblings found
> >
> >         at
> >
> org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementIm
> pl.java:269)
> >
> >         at
> >
> org.apache.axiom.om.impl.llom.OMNavigator._getFirstChild(OMNavigator.jav
> a:159)
> >
> >         at
> >
> org.apache.axiom.om.impl.llom.OMNavigator.updateNextNode(OMNavigator.jav
> a:128)
> >
> >         at
> > org.apache.axiom.om.impl.llom.OMNavigator.next(OMNavigator.java:109)
> >
> >         at
> >
> org.apache.axiom.om.impl.llom.OMStAXWrapper.updateNextNode(OMStAXWrapper
> .java:961)
> >
> >         at
> >
> org.apache.axiom.om.impl.llom.OMStAXWrapper.updateLastNode(OMStAXWrapper
> .java:950)
> >
> >         ... 22 more
>
>
> --
> Paul Fremantle
> VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
>
> http://bloglines.com/blog/paulfremantle
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Paul Fremantle
VP/Technology, WSO2 and OASIS WS-RX TC Co-chair

http://bloglines.com/blog/paulfremantle
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: Embedding XML into SOAP

Posted by Rich Adili <Ri...@xata.com>.
Thanks for the suggestions, Paul. I tried the nodatabinding approach and
it got me past my original problem. Unfortunately, both suggested
approaches return an OMElement and I have 48 web methods to implement.
I'm not keen on writing that much unwrapping code.

So, can someone tell me what I did wrong in the first place?

-----Original Message-----
From: Paul Fremantle [mailto:pzfreo@gmail.com] 
Sent: Friday, March 16, 2007 8:57 AM
To: axis-user@ws.apache.org
Subject: Re: Embedding XML into SOAP

Rich

Is the XML the whole of the SOAP body? Because its much simpler to use
the ServiceClient API which takes an OMElement directly.

ServiceClient sc = new ServiceClient(url);
// if the service needs an action:
sc.getOptions().setAction("http://whatever");
OMElement response = sc.sendReceive(omElement);

The other option is to generate the stub using the nodatabinding
approach which will mean you don't have all those classes.

Try wsdl2java -d none

Paul

On 3/16/07, Rich Adili <Ri...@xata.com> wrote:
>
>
>
> I'm writing a client for a service that takes an XML document as
input. I'm
> using WSDL2Java-generated code for my client. The generated code wants
an
> OMElement for the XML data. This snippet attempts to supply that.
Clearly,
> it ain't right as the send throws an exception. What am I doing wrong?
>
>
>
>         public void testme(final InputStream xmlStream) throws
Exception
>
>         {
>
>                 DispatchImportServiceStub stub = new
> DispatchImportServiceStub();
>
>                 DispatchImportServiceStub.ImportTripPlan
> dataObject =
>
>                                 new
> DispatchImportServiceStub.ImportTripPlan();
>
>                 DispatchImportServiceStub.Plan_type0 Plan =
> new DispatchImportServiceStub.Plan_type0();
>
>                 XMLStreamReader parser =
> XMLInputFactory.newInstance().createXMLStreamReader(xmlStream);
>
>                 StAXOMBuilder builder = new StAXOMBuilder(parser);
>
>                 OMElement documentElement =
builder.getDocumentElement();
>
>                 Plan.setExtraElement(documentElement);
>
>                 dataObject.setPlan(Plan);
>
>                 stub.ImportTripPlan(dataObject);
>
>         }
>
>
>
> org.apache.axis2.AxisFault: Error in extracting message properties;
nested
> exception is:
>
>         org.apache.rampart.RampartException: Error in
> extracting message properties
>
>         at
> org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65)
>
>         at
> org.apache.axis2.engine.Phase.invoke(Phase.java:382)
>
>         at
> org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:522)
>
>         at
> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:655)
>
>         at
>
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOper
ation.java:237)
>
>         at
>
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisO
peration.java:202)
>
>         at
>
net.xatanet.axisstubs.DispatchImportServiceStub.ImportTripPlan(DispatchI
mportServiceStub.java:141)
>
>         at
>
net.xatanet.services.DispatchImportService.ImportTripPlan(DispatchImport
Service.java:82)
>
>         at test.TestImportTripPlan.run(TestImportTripPlan.java:33)
>
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>         at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
>
>         at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
>
>         at java.lang.reflect.Method.invoke(Method.java:597)
>
>         at test.GUI$2$1.run(GUI.java:97)
>
>         at java.lang.Thread.run(Thread.java:619)
>
> Caused by: org.apache.rampart.RampartException: Error in
> extracting message properties
>
>         at
>
org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:294
)
>
>         at
> org.apache.rampart.MessageBuilder.build(MessageBuilder.java:56)
>
>         at
> org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:59)
>
>         ... 14 more
>
> Caused by: org.apache.ws.security.WSSecurityException:
> Error in converting SOAP Envelope to Document; nested exception is:
>
>         org.apache.axiom.om.OMException:
> javax.xml.stream.XMLStreamException:
> org.apache.axiom.om.OMException: Parser has already reached end of the
> document. No siblings found
>
>         at
>
org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.
java:121)
>
>         at
>
org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:146
)
>
>         ... 16 more
>
> Caused by: org.apache.axiom.om.OMException:
> javax.xml.stream.XMLStreamException:
> org.apache.axiom.om.OMException: Parser has already reached end of the
> document. No siblings found
>
>         at
>
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:1
99)
>
>         at
> org.apache.axiom.om.impl.dom.NodeImpl.build(NodeImpl.java:469)
>
>         at
> org.apache.axiom.om.impl.dom.DocumentImpl.build(DocumentImpl.java:476)
>
>         at
>
org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.
java:107)
>
>         ... 17 more
>
> Caused by: javax.xml.stream.XMLStreamException:
> org.apache.axiom.om.OMException: Parser has already reached end of the
> document. No siblings found
>
>         at
>
org.apache.axiom.om.impl.llom.OMStAXWrapper.updateLastNode(OMStAXWrapper
.java:952)
>
>         at
>
org.apache.axiom.om.impl.llom.OMStAXWrapper.next(OMStAXWrapper.java:913)
>
>         at
>
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:1
16)
>
>         ... 20 more
>
> Caused by: org.apache.axiom.om.OMException: Parser has already reached
end
> of the document. No siblings found
>
>         at
>
org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementIm
pl.java:269)
>
>         at
>
org.apache.axiom.om.impl.llom.OMNavigator._getFirstChild(OMNavigator.jav
a:159)
>
>         at
>
org.apache.axiom.om.impl.llom.OMNavigator.updateNextNode(OMNavigator.jav
a:128)
>
>         at
> org.apache.axiom.om.impl.llom.OMNavigator.next(OMNavigator.java:109)
>
>         at
>
org.apache.axiom.om.impl.llom.OMStAXWrapper.updateNextNode(OMStAXWrapper
.java:961)
>
>         at
>
org.apache.axiom.om.impl.llom.OMStAXWrapper.updateLastNode(OMStAXWrapper
.java:950)
>
>         ... 22 more


-- 
Paul Fremantle
VP/Technology, WSO2 and OASIS WS-RX TC Co-chair

http://bloglines.com/blog/paulfremantle
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Embedding XML into SOAP

Posted by Paul Fremantle <pz...@gmail.com>.
Rich

Is the XML the whole of the SOAP body? Because its much simpler to use
the ServiceClient API which takes an OMElement directly.

ServiceClient sc = new ServiceClient(url);
// if the service needs an action:
sc.getOptions().setAction("http://whatever");
OMElement response = sc.sendReceive(omElement);

The other option is to generate the stub using the nodatabinding
approach which will mean you don't have all those classes.

Try wsdl2java -d none

Paul

On 3/16/07, Rich Adili <Ri...@xata.com> wrote:
>
>
>
> I'm writing a client for a service that takes an XML document as input. I'm
> using WSDL2Java-generated code for my client. The generated code wants an
> OMElement for the XML data. This snippet attempts to supply that. Clearly,
> it ain't right as the send throws an exception. What am I doing wrong?
>
>
>
>         public void testme(final InputStream xmlStream) throws Exception
>
>         {
>
>                 DispatchImportServiceStub stub = new
> DispatchImportServiceStub();
>
>                 DispatchImportServiceStub.ImportTripPlan
> dataObject =
>
>                                 new
> DispatchImportServiceStub.ImportTripPlan();
>
>                 DispatchImportServiceStub.Plan_type0 Plan =
> new DispatchImportServiceStub.Plan_type0();
>
>                 XMLStreamReader parser =
> XMLInputFactory.newInstance().createXMLStreamReader(xmlStream);
>
>                 StAXOMBuilder builder = new StAXOMBuilder(parser);
>
>                 OMElement documentElement = builder.getDocumentElement();
>
>                 Plan.setExtraElement(documentElement);
>
>                 dataObject.setPlan(Plan);
>
>                 stub.ImportTripPlan(dataObject);
>
>         }
>
>
>
> org.apache.axis2.AxisFault: Error in extracting message properties; nested
> exception is:
>
>         org.apache.rampart.RampartException: Error in
> extracting message properties
>
>         at
> org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65)
>
>         at
> org.apache.axis2.engine.Phase.invoke(Phase.java:382)
>
>         at
> org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:522)
>
>         at
> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:655)
>
>         at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:237)
>
>         at
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
>
>         at
> net.xatanet.axisstubs.DispatchImportServiceStub.ImportTripPlan(DispatchImportServiceStub.java:141)
>
>         at
> net.xatanet.services.DispatchImportService.ImportTripPlan(DispatchImportService.java:82)
>
>         at test.TestImportTripPlan.run(TestImportTripPlan.java:33)
>
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
>         at java.lang.reflect.Method.invoke(Method.java:597)
>
>         at test.GUI$2$1.run(GUI.java:97)
>
>         at java.lang.Thread.run(Thread.java:619)
>
> Caused by: org.apache.rampart.RampartException: Error in
> extracting message properties
>
>         at
> org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:294)
>
>         at
> org.apache.rampart.MessageBuilder.build(MessageBuilder.java:56)
>
>         at
> org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:59)
>
>         ... 14 more
>
> Caused by: org.apache.ws.security.WSSecurityException:
> Error in converting SOAP Envelope to Document; nested exception is:
>
>         org.apache.axiom.om.OMException:
> javax.xml.stream.XMLStreamException:
> org.apache.axiom.om.OMException: Parser has already reached end of the
> document. No siblings found
>
>         at
> org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.java:121)
>
>         at
> org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:146)
>
>         ... 16 more
>
> Caused by: org.apache.axiom.om.OMException:
> javax.xml.stream.XMLStreamException:
> org.apache.axiom.om.OMException: Parser has already reached end of the
> document. No siblings found
>
>         at
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:199)
>
>         at
> org.apache.axiom.om.impl.dom.NodeImpl.build(NodeImpl.java:469)
>
>         at
> org.apache.axiom.om.impl.dom.DocumentImpl.build(DocumentImpl.java:476)
>
>         at
> org.apache.rampart.util.Axis2Util.getDocumentFromSOAPEnvelope(Axis2Util.java:107)
>
>         ... 17 more
>
> Caused by: javax.xml.stream.XMLStreamException:
> org.apache.axiom.om.OMException: Parser has already reached end of the
> document. No siblings found
>
>         at
> org.apache.axiom.om.impl.llom.OMStAXWrapper.updateLastNode(OMStAXWrapper.java:952)
>
>         at
> org.apache.axiom.om.impl.llom.OMStAXWrapper.next(OMStAXWrapper.java:913)
>
>         at
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:116)
>
>         ... 20 more
>
> Caused by: org.apache.axiom.om.OMException: Parser has already reached end
> of the document. No siblings found
>
>         at
> org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementImpl.java:269)
>
>         at
> org.apache.axiom.om.impl.llom.OMNavigator._getFirstChild(OMNavigator.java:159)
>
>         at
> org.apache.axiom.om.impl.llom.OMNavigator.updateNextNode(OMNavigator.java:128)
>
>         at
> org.apache.axiom.om.impl.llom.OMNavigator.next(OMNavigator.java:109)
>
>         at
> org.apache.axiom.om.impl.llom.OMStAXWrapper.updateNextNode(OMStAXWrapper.java:961)
>
>         at
> org.apache.axiom.om.impl.llom.OMStAXWrapper.updateLastNode(OMStAXWrapper.java:950)
>
>         ... 22 more


-- 
Paul Fremantle
VP/Technology, WSO2 and OASIS WS-RX TC Co-chair

http://bloglines.com/blog/paulfremantle
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org