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 "Reneta Säll (HF/EBC)" <re...@ericsson.com> on 2007/05/10 15:51:33 UTC
Axis2: OMElement response message problem
Hi everybody,
I'm having a problem with Axis2 web service that uploads txt file. The downloading works fine.
The file content is binary 64 type and is transfered as xml element in the Soap message.(not as attachment!!!)
The size of my txt file is 3 KB. When I minimized the file size to1 KB then the problem does't exist.
The web service works fine with Axis 1.4. but not in Axis2?
Is the max size of the OMElement in the response limited: firstChild, LastChild in some way?
When I ran the client it occured a wrong: java.lang.NullPointerException, then I debuged, it shows that: com.sun.jdi.InvocationException - exception held inside the result.
I am using autogenerated wsdl2java Stub:
public org.apache.axiom.om.OMElement View( org.apache.axiom.om.OMElement param18) throws java.rmi.RemoteException
{
try
{
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.
createClient(_operations[0].getName());
_operationClient.getOptions().setAction("urn:#View");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
// create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env = null;
//Style is Doc.
env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),param18,optimizeContent(new javax.xml.namespace.QName("","View")));
//adding SOAP headers
_serviceClient.addHeadersToEnvelope(env);
// create message context with that soap envelope
org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
_messageContext.setEnvelope(env);
// add the message contxt to the operation client
_operationClient.addMessageContext(_messageContext);
//execute the operation client
_operationClient.execute(true);
org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext (org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
org.apache.axiom.om.OMElement omElement = _returnEnv.getBody().getFirstElement();
java.lang.Object object = fromOM( _returnEnv.getBody().getFirstElement(), org.apache.axiom.om.OMElement.class, getEnvelopeNamespaces (_returnEnv));
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
return (org.apache.axiom.om.OMElement) object;
}
When I debug this (autogenerated) piece of code with a breakpoint on the return statement, the debugger says "com.sun.jdi.InvocationException occurred invoking method" and I get cin the client java.lang.NullPointerException.
I hope this is enough information. Please help me out with this.
Best regards, Reneta
Re: Axis2: OMElement response message problem
Posted by Martin Gainty <mg...@hotmail.com>.
Reneta
I would go with Thilina's suggestion of implementing with MTOM since encoding your data is base64Binary and works with the provided sample
e.g.
<wsdl:types>
- <xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://ws.apache.org/axis2/mtomsample/">
<xsd:import namespace="http://www.w3.org/2005/05/xmlmime" schemaLocation="MTOMSample?xsd=xsd0" />
- <xsd:complexType name="AttachmentType">
- <xsd:sequence>
<xsd:element minOccurs="0" name="fileName" type="xsd:string" />
<xsd:element minOccurs="0" name="binaryData" type="xmime:base64Binary" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="AttachmentRequest" type="tns:AttachmentType" />
<xsd:element name="AttachmentResponse" type="xsd:string" />
</xsd:schema>
</wsdl:types>
- <wsdl:message name="AttachmentRequest">
<wsdl:part name="part1" element="tns:AttachmentRequest" />
</wsdl:message>
On the other hand SWA seems to be attachment oriented but not necessarily geared to encoding Binary64 e.g.
- <xs:element name="uploadFile">
- <xs:complexType>
- <xs:sequence>
<xs:element name="name" nillable="true" type="xs:string" />
<xs:element name="attchmentID" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="uploadFileResponse">
- <xs:complexType>
- <xs:sequence>
<xs:element name="return" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
- <wsdl:message name="uploadFileMessage">
<wsdl:part name="part1" element="ns0:uploadFile" />
</wsdl:message>
Once all MTOM aspects are operational then work on the response..
Bon Chance/
M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed. If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy. Thank you.
----- Original Message -----
From: Reneta Säll (HF/EBC)
To: axis-user@ws.apache.org
Sent: Thursday, May 10, 2007 9:51 AM
Subject: Axis2: OMElement response message problem
Hi everybody,
I'm having a problem with Axis2 web service that uploads txt file. The downloading works fine.
The file content is binary 64 type and is transfered as xml element in the Soap message.(not as attachment!!!)
The size of my txt file is 3 KB. When I minimized the file size to1 KB then the problem does't exist.
The web service works fine with Axis 1.4. but not in Axis2?
Is the max size of the OMElement in the response limited: firstChild, LastChild in some way?
When I ran the client it occured a wrong: java.lang.NullPointerException, then I debuged, it shows that: com.sun.jdi.InvocationException - exception held inside the result.
I am using autogenerated wsdl2java Stub:
public org.apache.axiom.om.OMElement View( org.apache.axiom.om.OMElement param18) throws java.rmi.RemoteException
{
try
{
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.
createClient(_operations[0].getName());
_operationClient.getOptions().setAction("urn:#View");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
// create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env = null;
//Style is Doc.
env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),param18,optimizeContent(new javax.xml.namespace.QName("","View")));
//adding SOAP headers
_serviceClient.addHeadersToEnvelope(env);
// create message context with that soap envelope
org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
_messageContext.setEnvelope(env);
// add the message contxt to the operation client
_operationClient.addMessageContext(_messageContext);
//execute the operation client
_operationClient.execute(true);
org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext (org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
org.apache.axiom.om.OMElement omElement = _returnEnv.getBody().getFirstElement();
java.lang.Object object = fromOM( _returnEnv.getBody().getFirstElement(), org.apache.axiom.om.OMElement.class, getEnvelopeNamespaces (_returnEnv));
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
return (org.apache.axiom.om.OMElement) object;
}
When I debug this (autogenerated) piece of code with a breakpoint on the return statement, the debugger says "com.sun.jdi.InvocationException occurred invoking method" and I get cin the client java.lang.NullPointerException.
I hope this is enough information. Please help me out with this.
Best regards, Reneta
RE: Axis2: OMElement response message problem
Posted by "Reneta Säll (HF/EBC)" <re...@ericsson.com>.
Hi Martin,
thank you for your answer.
The reason is time and that I would like to reuse my Axis 1 .xsd, wsdl and server side code since it is an working application.
But if it is not possible to upload xml element with 3 Kb size in Axis2 (strange thing is that when debuging and looking on the reterned response envelope then is working fine - timing?) I need to know, then I have to look at SWA or MTOM.
Best regards, Reneta
________________________________
From: Martin Gainty [mailto:mgainty@hotmail.com]
Sent: den 10 maj 2007 16:42
To: axis-user@ws.apache.org
Subject: Re: Axis2: OMElement response message problem
Any reason why you are cannot xmit the entity with Attachment as in /sample/soapwithattachments/client/SWAClient.java example?
M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed. If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy. Thank you.
----- Original Message -----
From: Reneta Säll (HF/EBC) <ma...@ericsson.com>
To: axis-user@ws.apache.org
Sent: Thursday, May 10, 2007 9:51 AM
Subject: Axis2: OMElement response message problem
Hi everybody,
I'm having a problem with Axis2 web service that uploads txt file. The downloading works fine.
The file content is binary 64 type and is transfered as xml element in the Soap message.(not as attachment!!!)
The size of my txt file is 3 KB. When I minimized the file size to1 KB then the problem does't exist.
The web service works fine with Axis 1.4. but not in Axis2?
Is the max size of the OMElement in the response limited: firstChild, LastChild in some way?
When I ran the client it occured a wrong: java.lang.NullPointerException, then I debuged, it shows that: com.sun.jdi.InvocationException - exception held inside the result.
I am using autogenerated wsdl2java Stub:
public org.apache.axiom.om.OMElement View( org.apache.axiom.om.OMElement param18) throws java.rmi.RemoteException
{
try
{
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.
createClient(_operations[0].getName());
_operationClient.getOptions().setAction("urn:#View");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
// create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env = null;
//Style is Doc.
env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),param18,optimizeContent(new javax.xml.namespace.QName("","View")));
//adding SOAP headers
_serviceClient.addHeadersToEnvelope(env);
// create message context with that soap envelope
org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
_messageContext.setEnvelope(env);
// add the message contxt to the operation client
_operationClient.addMessageContext(_messageContext);
//execute the operation client
_operationClient.execute(true);
org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext (org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
org.apache.axiom.om.OMElement omElement = _returnEnv.getBody().getFirstElement();
java.lang.Object object = fromOM( _returnEnv.getBody().getFirstElement(), org.apache.axiom.om.OMElement.class, getEnvelopeNamespaces (_returnEnv));
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
return (org.apache.axiom.om.OMElement) object;
}
When I debug this (autogenerated) piece of code with a breakpoint on the return statement, the debugger says "com.sun.jdi.InvocationException occurred invoking method" and I get cin the client java.lang.NullPointerException.
I hope this is enough information. Please help me out with this.
Best regards, Reneta
Re: Axis2: OMElement response message problem
Posted by Martin Gainty <mg...@hotmail.com>.
Any reason why you are cannot xmit the entity with Attachment as in /sample/soapwithattachments/client/SWAClient.java example?
M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed. If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy. Thank you.
----- Original Message -----
From: Reneta Säll (HF/EBC)
To: axis-user@ws.apache.org
Sent: Thursday, May 10, 2007 9:51 AM
Subject: Axis2: OMElement response message problem
Hi everybody,
I'm having a problem with Axis2 web service that uploads txt file. The downloading works fine.
The file content is binary 64 type and is transfered as xml element in the Soap message.(not as attachment!!!)
The size of my txt file is 3 KB. When I minimized the file size to1 KB then the problem does't exist.
The web service works fine with Axis 1.4. but not in Axis2?
Is the max size of the OMElement in the response limited: firstChild, LastChild in some way?
When I ran the client it occured a wrong: java.lang.NullPointerException, then I debuged, it shows that: com.sun.jdi.InvocationException - exception held inside the result.
I am using autogenerated wsdl2java Stub:
public org.apache.axiom.om.OMElement View( org.apache.axiom.om.OMElement param18) throws java.rmi.RemoteException
{
try
{
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.
createClient(_operations[0].getName());
_operationClient.getOptions().setAction("urn:#View");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
// create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env = null;
//Style is Doc.
env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),param18,optimizeContent(new javax.xml.namespace.QName("","View")));
//adding SOAP headers
_serviceClient.addHeadersToEnvelope(env);
// create message context with that soap envelope
org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
_messageContext.setEnvelope(env);
// add the message contxt to the operation client
_operationClient.addMessageContext(_messageContext);
//execute the operation client
_operationClient.execute(true);
org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext (org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
org.apache.axiom.om.OMElement omElement = _returnEnv.getBody().getFirstElement();
java.lang.Object object = fromOM( _returnEnv.getBody().getFirstElement(), org.apache.axiom.om.OMElement.class, getEnvelopeNamespaces (_returnEnv));
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
return (org.apache.axiom.om.OMElement) object;
}
When I debug this (autogenerated) piece of code with a breakpoint on the return statement, the debugger says "com.sun.jdi.InvocationException occurred invoking method" and I get cin the client java.lang.NullPointerException.
I hope this is enough information. Please help me out with this.
Best regards, Reneta