OK, both the stub and the in / out MR need to have build() invoked on the
soap envelope when using xmlbeans in 1.2 .

Creating a jira now  ...

Robert

On 5/13/07, Davanum Srinivas <[EMAIL PROTECTED]> wrote:

Quick way, edit the Stub, find the method you are invoking, inside the
method, just before "_operationClient.execute(true);" call
"env.build()" where env is the envelope that is being sent.

thanks,
dims

On 5/13/07, robert lazarski <[EMAIL PROTECTED]> wrote:
> build() on the SoapEnvelope / Payload ? I should probably know this but
...
> How do I get a handle on that, client side, with xmlbeans ? How do I
build
> the tree using a stub, before I send it ? Late night on sunday, hints
please
> ;-).
>
> Robert
>
>
> On 5/13/07, Davanum Srinivas < [EMAIL PROTECTED]> wrote:
> >
> > Robert,
> >
> > Could you try calling build() to make sure the whole thing is built
> > (so that Streaming is not used)?
> >
> > thanks,
> > dims
> >
> > On 5/13/07, robert lazarski <[EMAIL PROTECTED] > wrote:
> > > Hi all,
> > >
> > > I'm seeing this exception in the 1.2 release:
> > >
> > > [java] java.lang.NullPointerException
> > >      [java]     at
> > >
> com.ctc.wstx.sw.BaseNsStreamWriter.doWriteDefaultNs(
BaseNsStreamWriter.java:529)
> > >      [java]     at
> > >
> com.ctc.wstx.sw.SimpleNsStreamWriter.writeDefaultNamespace
> (SimpleNsStreamWriter.java:113)
> > >      [java]     at
> > >
> com.ctc.wstx.sw.SimpleNsStreamWriter.writeNamespace(
SimpleNsStreamWriter.java:121)
> > >      [java]     at
> > >
> org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeNamespace
> > > (MTOMXMLStreamWriter.java:148)
> > >      [java]     at
> > >
>
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeElement(
StreamingOMSerializer.java:238)
> > >      [java]     at
> > >
> org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeNode
> > > (StreamingOMSerializer.java:71)
> > >      [java]     at
> > >
> org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(
StreamingOMSerializer.java:54)
> > >      [java]     at
> > >
> org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream
> > > (OMSerializerUtil.java:490)
> > >      [java]     at
> > >
> org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(
OMElementImpl.java:783)
> > >      [java]     at
> > >
> org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume
> > > (OMElementImpl.java:808)
> > >      [java]     at
> > >
> org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(
SOAPEnvelopeImpl.java:234)
> > >      [java]     at
> > >
> org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize
> > > (SOAPEnvelopeImpl.java:222)
> > >      [java]     at
> > >
> org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(
OMElementImpl.java:808)
> > >      [java]     at
> > >
> org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume
> > > (OMNodeImpl.java:418)
> > >      [java]     at
> > >
> org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(
SOAPMessageFormatter.java:55)
> > >      [java]     at
> > >
> org.apache.axis2.transport.http.AxisRequestEntity.writeRequest
> (AxisRequestEntity.java
> > > :84)
> > >      [java]     at
> > >
>
org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody
(EntityEnclosingMethod.java:495)
> > >      [java]     at
> > >
> org.apache.commons.httpclient.HttpMethodBase.writeRequest
> (HttpMethodBase.java
> > > :1973)
> > >      [java]     at
> > >
> org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java
:993)
> > >      [java]     at
> > >
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry
> (HttpMethodDirector.java:397)
> > >      [java]     at
> > >
> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(
HttpMethodDirector.java:170)
> > >      [java]     at
> > > org.apache.commons.httpclient.HttpClient.executeMethod
> (HttpClient.java:396)
> > >      [java]     at
> > >
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java
:346)
> > >      [java]     at
> > >
> org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod
> (AbstractHTTPSender.java:558)
> > >      [java]     at
> > > org.apache.axis2.transport.http.HTTPSender.sendViaPost
> > > (HTTPSender.java:176)
> > >      [java]     at
> > > org.apache.axis2.transport.http.HTTPSender.send
> (HTTPSender.java:73)
> > >      [java]     at
> > >
>
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons
(CommonsHTTPTransportSender.java
> > > :305)
> > >      [java]     at
> > >
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke
> (CommonsHTTPTransportSender.java:201)
> > >      [java]     at
> > >
> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:452)
> > >      [java]     at
> > >
> org.apache.axis2.description.OutInAxisOperationClient.send
> (OutInAxisOperation.java:330)
> > >      [java]     at
> > >
> org.apache.axis2.description.OutInAxisOperationClient.execute(
OutInAxisOperation.java:294)
> > >      [java]     at
> > >
>
br.hapvida.webservices.tissloteguias.endpoint.TissLoteGuiasStub.tissLoteGuias_Operation
> (TissLoteGuiasStub.java:215)
> > >      [java]     at
> > > org.test.LotesClient.invokeLotes(LotesClient.java:56)
> > >      [java]     at org.test.LotesClient.main (LotesClient.java:23)
> > >
> > > ...
> > >
> > > Which curiously seems to match a recent report to the users list:
> > >
> > > http://marc.info/?l=axis-user&m=117892343312805&w=2
> > >
> > >
> > > In my case this error happens on an xmlbeans client invokation which
> never
> > > reaches the server - its a pretty complex, government like schema so
I
> need
> > > xmlbeans. Here's my code, which seems to passing a valid xmlbeans
> document:
> > >
> > > package org.test;
> > >
> > > import java.io.File;
> > > import java.util.ArrayList;
> > > import java.util.List;
> > >
> > > import org.apache.axis2.addressing.EndpointReference;
> > > import org.apache.axis2.client.Options;
> > > import org.apache.xmlbeans.XmlError;
> > > import org.apache.xmlbeans.XmlOptions;
> > >
> > > import
> > >
> br.gov.ans.www.padroes.tiss.schemas.MensagemTISSDocument;
> > > import
> > >
> br.gov.ans.www.tiss.ws.tipos.tissloteguias.ProtocoloRecebimentoDocument
> > > ;
> > > import
> > >
> br.hapvida.webservices.tissloteguias.endpoint.TissLoteGuiasStub;
> > >
> > > public class LotesClient {
> > >
> > >      /** Access point inside the servlet container. **/
> > >     private static EndpointReference targetEPR =
> > >        new EndpointReference(
> > >
> > > "
> http://localhost:9080/axis2-1.2-SNAPSHOT/services/tissLoteGuias";);
> > >         public static void main(String[] args) {
> > >             invokeLotes();
> > >         }
> > >
> > >         public static void invokeLotes() {
> > >         // lotes request document
> > >
> > >
> br.gov.ans.www.tiss.ws.tipos.tissloteguias.LoteGuiasDocument
> > > loteGuiasDocument =
> > >
> > >
>
br.gov.ans.www.tiss.ws.tipos.tissloteguias.LoteGuiasDocument.Factory.newInstance
> ();
> > >
> > >         try {
> > >             // lotes request
> > >             MensagemTISSDocument mtd_lotes_request =
> > > MensagemTISSDocument.Factory.parse (new
> > >
> File("/home/iksrazal/workspace/hapvida/wsdl/ENVIO_LOTE_GUIAS.xml"));
> > >
> > > br.gov.ans.www.tiss.ws.tipos.tissloteguias.WsLoteGuias
> > > wsLoteGuias =
> > >
> > >
>
br.gov.ans.www.tiss.ws.tipos.tissloteguias.WsLoteGuias.Factory.newInstance
> > > ();
> > >
> > >
> > >
> wsLoteGuias.setCabecalho
(mtd_lotes_request.getMensagemTISS().getCabecalho());
> > >
> > >
> wsLoteGuias.setLoteGuias
(mtd_lotes_request.getMensagemTISS().getPrestadorParaOperadora().getLoteGuias());
> > >
> > > wsLoteGuias.setHash
> (mtd_lotes_request.getMensagemTISS().getEpilogo().getHash());
> > >
> > >             loteGuiasDocument.setLoteGuias(wsLoteGuias);
> > >             System.out.println("\nSending request
loteGuiasDocument\n");
> > >             System.out.println(loteGuiasDocument.xmlText());
> > >
> > >             TissLoteGuiasStub stub = new TissLoteGuiasStub();
> > >             Options options = new Options();
> > >             options.setTo (targetEPR);
> > >
> stub._getServiceClient().setOptions(options);
> > >
> > >             XmlError error =
> > > validateWsLoteGuias(wsLoteGuias);
> > >             if (error != null) {
> > >                 throw new Exception("Objeto wsLoteGuias "
> > >                     + "is invalid: "
> > >                     + error);
> > >             }
> > >             ProtocoloRecebimentoDocument
protocoloRecebimentoDocument =
> > > stub.tissLoteGuias_Operation(loteGuiasDocument);
> > >             System.out.println("\nRecieved response
> > > protocoloRecebimentoDocument\n");
> > >             System.out.println(protocoloRecebimentoDocument);
> > >         } catch (Exception ex) {
> > >             ex.printStackTrace ();
> > >         }
> > >    }
> > >
> > >    public static XmlError validateWsLoteGuias (
> > >
> > > br.gov.ans.www.tiss.ws.tipos.tissloteguias.WsLoteGuias
> > > wsLoteGuias) {
> > >        // Create an XmlOptions instance and set the error listener.
> > >        XmlOptions validateOptions = new XmlOptions();
> > >        List<XmlError> errorList = new ArrayList<XmlError>();
> > >        validateOptions.setErrorListener(errorList);
> > >        if (!wsLoteGuias.validate(validateOptions)) {
> > >            for (int i = 0; i < errorList.size(); i++) {
> > >                XmlError error = (XmlError)errorList.get(i);
> > >                System.out.println("Object wsLoteGuias "
> > >                    + "is invalid, "
> > >                    + "The following field is empty: ");
> > >                 System.out.println("\n");
> > >                System.out.println("Error Message: " +
error.getMessage()
> +
> > > "\n");
> > >                System.out.println("Location of invalid XML: "
> > >                    + error.getCursorLocation().xmlText() + "\n");
> > >            }
> > >            return errorList.get(0);
> > >        }
> > >        System.out.println("wsLoteGuias seems to be valid\n");
> > >        return null;
> > >    }
> > > }
> > >
> > > Any clues on what is going wrong?
> > > Robert
> > >
> >
> >
> > --
> > Davanum Srinivas :: http://davanum.wordpress.com
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>


--
Davanum Srinivas :: http://davanum.wordpress.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to