Raw SOAP XML response

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Raw SOAP XML response

Sterpu Victor
Hello
 
I need to save the raw SOAP XML response from Axis2(I use axis 2 1.7.3).
When Axis2 call retusrns an error this code works: String response = sc.getLastOperationContext().getMessageContext("In").getEnvelope().toString();
But when I run a succesful Axis2 call the same code gives the following error: "java.lang.IllegalStateException: Can't process next node because caching is disabled"
 
I tryed to enable cache like this, but it didn't work:
 
                                ServiceClient sc = (ServiceClient)method_getServiceClient.invoke(objectReflect);
                                ServiceContext srv_context = sc.getServiceContext();
                                srv_context.setCachingOperationContext(true);
                                OperationContext oc= new OperationContext(); 
                                oc.setComplete(true); 
                                srv_context.setLastOperationContext(oc);
 
Thank you

 
Reply | Threaded
Open this post in threaded view
|

Re: Raw SOAP XML response

Martin Gainty

possible outdated version of axiom


     * In Axiom versions prior to 1.2.9, the sequence of events was inconsistent if the
     * underlying stream is XOP encoded and caching is disabled (see WSCOMMONS-485).
     * This made it necessary for the caller to (partially) handle the XOP processing and to use
     * {@link OMAttachmentAccessor#getDataHandler(String)} to retrieve the binary content.
     * Starting with 1.2.9 this is no longer be the case: as specified above,
     * the sequence of events is *independent of the state of the object model*
     * and the value of the <code>cache</code> parameter,
     * and ALL binary content is reported through the
     * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} (embedded in axiom-api) extension.

upgrade axiom to 1.2.9 a recompile, package, deploy and run with 1.2.9 should mitigate the error you are now receiving

*please keep us apprised*


Martin
______________________________________________



From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 2, 2016 9:37 AM
To: [hidden email]
Subject: Raw SOAP XML response
 
Hello
 
I need to save the raw SOAP XML response from Axis2(I use axis 2 1.7.3).
When Axis2 call retusrns an error this code works: String response = sc.getLastOperationContext().getMessageContext("In").getEnvelope().toString();
But when I run a succesful Axis2 call the same code gives the following error: "java.lang.IllegalStateException: Can't process next node because caching is disabled"
 
I tryed to enable cache like this, but it didn't work:
 
                                ServiceClient sc = (ServiceClient)method_getServiceClient.invoke(objectReflect);
                                ServiceContext srv_context = sc.getServiceContext();
                                srv_context.setCachingOperationContext(true);
                                OperationContext oc= new OperationContext(); 
                                oc.setComplete(true); 
                                srv_context.setLastOperationContext(oc);
 
Thank you

 
Reply | Threaded
Open this post in threaded view
|

Re[2]: Raw SOAP XML response

Sterpu Victor
It didn't work.
This is what I did: I deleted from the directory of Axis2\lib 4 files: axiom-jaxb-1.2.19.jar, axiom-api-1.2.19.jar, axiom-dom-1.2.19.jar, axiom-impl-1.2.19.jar
and I added these 4 files: axiom-api-1.2.20.jar,axiom-dom-1.2.20.jar,axiom-impl-1.2.20.jar,axiom-jaxb-1.2.20.jar.
I use Axis embeded so I also deleted from my netbeans libraries the old jars and added the new ones.
I recompiled and the error remained.
 
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
To: "[hidden email]" <[hidden email]>; "Sterpu Victor" <[hidden email]>
Sent: 2/11/2016 4:58:09 PM
Subject: Re: Raw SOAP XML response
 

possible outdated version of axiom


     * In Axiom versions prior to 1.2.9, the sequence of events was inconsistent if the
     * underlying stream is XOP encoded and caching is disabled (see WSCOMMONS-485).
     * This made it necessary for the caller to (partially) handle the XOP processing and to use
     * {@link OMAttachmentAccessor#getDataHandler(String)} to retrieve the binary content.
     * Starting with 1.2.9 this is no longer be the case: as specified above,
     * the sequence of events is *independent of the state of the object model*
     * and the value of the <code>cache</code> parameter,
     * and ALL binary content is reported through the
     * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} (embedded in axiom-api) extension.

upgrade axiom to 1.2.9 a recompile, package, deploy and run with 1.2.9 should mitigate the error you are now receiving

*please keep us apprised*


Martin
______________________________________________



From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 2, 2016 9:37 AM
To: [hidden email]
Subject: Raw SOAP XML response
 
Hello
 
I need to save the raw SOAP XML response from Axis2(I use axis 2 1.7.3).
When Axis2 call retusrns an error this code works: String response = sc.getLastOperationContext().getMessageContext("In").getEnvelope().toString();
But when I run a succesful Axis2 call the same code gives the following error: "java.lang.IllegalStateException: Can't process next node because caching is disabled"
 
I tryed to enable cache like this, but it didn't work:
 
                                ServiceClient sc = (ServiceClient)method_getServiceClient.invoke(objectReflect);
                                ServiceContext srv_context = sc.getServiceContext();
                                srv_context.setCachingOperationContext(true);
                                OperationContext oc= new OperationContext(); 
                                oc.setComplete(true); 
                                srv_context.setLastOperationContext(oc);
 
Thank you

 
Reply | Threaded
Open this post in threaded view
|

Re: Re[2]: Raw SOAP XML response

Martin Gainty



From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 2, 2016 11:57 AM
To: Martin Gainty; [hidden email]
Subject: Re[2]: Raw SOAP XML response
 
It didn't work.
This is what I did: I deleted from the directory of Axis2\lib 4 files: axiom-jaxb-1.2.19.jar, axiom-api-1.2.19.jar, axiom-dom-1.2.19.jar, axiom-impl-1.2.19.jar
and I added these 4 files: axiom-api-1.2.20.jar,axiom-dom-1.2.20.jar,axiom-impl-1.2.20.jar,axiom-jaxb-1.2.20.jar.
I use Axis embeded so I also deleted from my netbeans libraries the old jars and added the new ones.
I recompiled and the error remained.
 
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
To: "[hidden email]" <[hidden email]>; "Sterpu Victor" <[hidden email]>
Sent: 2/11/2016 4:58:09 PM
Subject: Re: Raw SOAP XML response
 

possible outdated version of axiom


     * In Axiom versions prior to 1.2.9, the sequence of events was inconsistent if the
     * underlying stream is XOP encoded and caching is disabled (see WSCOMMONS-485).
     * This made it necessary for the caller to (partially) handle the XOP processing and to use
     * {@link OMAttachmentAccessor#getDataHandler(String)} to retrieve the binary content.
     * Starting with 1.2.9 this is no longer be the case: as specified above,
     * the sequence of events is *independent of the state of the object model*
     * and the value of the <code>cache</code> parameter,
     * and ALL binary content is reported through the
     * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} (embedded in axiom-api) extension.

upgrade axiom to 1.2.9 a recompile, package, deploy and run with 1.2.9 should mitigate the error you are now receiving

*please keep us apprised*


Martin
______________________________________________



From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 2, 2016 9:37 AM
To: [hidden email]
Subject: Raw SOAP XML response
 
Hello
 
I need to save the raw SOAP XML response from Axis2(I use axis 2 1.7.3).
When Axis2 call retusrns an error this code works: 
String response = sc.getLastOperationContext().getMessageContext("In").getEnvelope().toString();

MG>//build configurationContext from location of repo and name of axis2.xml
MG> ConfigurationContext configContext = ConfigurationContextFactory
.createConfigurationContextFromFileSystem("../../repository",  //exact location of repository
"axis2.xml");                           //exact filename of axis2.xml

MG>establish new ServiceClient implementing attributes from ConfigurationContext
MG> ServiceClient sender = new ServiceClient(configContext, null);

MG>you will need to supply a QName for incoming request and SOAP response output
/**
     * Operation name used for an anonymous in-out operation (meaning we sent a message and receive
     * a response, equivalent to a WSDL In-Out operation).
     
    public static final QName ANON_OUT_IN_OP = new QName(Constants.AXIS2_NAMESPACE_URI,
                                                         "anonOutInOp",
                                                         Constants.AXIS2_NAMESPACE_PREFIX);
*/
MG>OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP); 

MG>ask client to contact axis2 server and pull a response back
MG>MessageContext response=mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE));
/**
     *MESSAGE_LABEL_IN_VALUE Constant to represent the message label "In" which is used by the
     * following WSDL 2.0 defined MEPs: In-Only, Robust In-Only, In-Out, //Hint: In-Out is your Message Exchange
     * In-Optional-Out, Out-In, Out-Optional-In.
    public static final byte MESSAGE_LABEL_IN = 0;
    public static final String MESSAGE_LABEL_IN_VALUE = "In";
*/

MG>convert soapEnvelope to String
MG>String response =response.getEnvelope().toString();

MG>?
But when I run a succesful Axis2 call the same code gives the following error: "java.lang.IllegalStateException: Can't process next node because caching is disabled"
 
I tryed to enable cache like this, but it didn't work:
 
                                ServiceClient sc = (ServiceClient)method_getServiceClient.invoke(objectReflect);
                                ServiceContext srv_context = sc.getServiceContext();
                                srv_context.setCachingOperationContext(true);
                                OperationContext oc= new OperationContext(); 
                                oc.setComplete(true); 
                                srv_context.setLastOperationContext(oc);
 
Thank you

 
Reply | Threaded
Open this post in threaded view
|

Re: Raw SOAP XML response

Andreas Veithen-2
In reply to this post by Sterpu Victor
This is by design. To avoid the overhead of building a complete DOM
like representation of the message, Axis2 actually consumes the
message (more specifically the content of the SOAP Body element) when
converting it to a Java object. Once that is done, the original
message can no longer be serialized. In the fault case the situation
is different because Axis2 doesn't get to the point where it would
consume (part of) the message.

Andreas

On Wed, Nov 2, 2016 at 1:37 PM, Sterpu Victor <[hidden email]> wrote:

> Hello
>
> I need to save the raw SOAP XML response from Axis2(I use axis 2 1.7.3).
> When Axis2 call retusrns an error this code works: String response =
> sc.getLastOperationContext().getMessageContext("In").getEnvelope().toString();
> But when I run a succesful Axis2 call the same code gives the following
> error: "java.lang.IllegalStateException: Can't process next node because
> caching is disabled"
>
> I tryed to enable cache like this, but it didn't work:
>
>                                 ServiceClient sc =
> (ServiceClient)method_getServiceClient.invoke(objectReflect);
>                                 ServiceContext srv_context =
> sc.getServiceContext();
>
> srv_context.setCachingOperationContext(true);
>                                 OperationContext oc= new OperationContext();
>                                 oc.setComplete(true);
>                                 srv_context.setLastOperationContext(oc);
>
> Thank you
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Raw SOAP XML response

sanjib mondal
Hi ,

Please unsubscribe my email id from all the list of ais.apache.org.

I have already informed this so many times but still i am getting email. If i get email next time then i need to proceed with legal procedure.


Thanks
Sanjeev

On Thu, Nov 3, 2016 at 5:37 AM, Andreas Veithen <[hidden email]> wrote:
This is by design. To avoid the overhead of building a complete DOM
like representation of the message, Axis2 actually consumes the
message (more specifically the content of the SOAP Body element) when
converting it to a Java object. Once that is done, the original
message can no longer be serialized. In the fault case the situation
is different because Axis2 doesn't get to the point where it would
consume (part of) the message.

Andreas

On Wed, Nov 2, 2016 at 1:37 PM, Sterpu Victor <[hidden email]> wrote:
> Hello
>
> I need to save the raw SOAP XML response from Axis2(I use axis 2 1.7.3).
> When Axis2 call retusrns an error this code works: String response =
> sc.getLastOperationContext().getMessageContext("In").getEnvelope().toString();
> But when I run a succesful Axis2 call the same code gives the following
> error: "java.lang.IllegalStateException: Can't process next node because
> caching is disabled"
>
> I tryed to enable cache like this, but it didn't work:
>
>                                 ServiceClient sc =
> (ServiceClient)method_getServiceClient.invoke(objectReflect);
>                                 ServiceContext srv_context =
> sc.getServiceContext();
>
> srv_context.setCachingOperationContext(true);
>                                 OperationContext oc= new OperationContext();
>                                 oc.setComplete(true);
>                                 srv_context.setLastOperationContext(oc);
>
> Thank you
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re[4]: Raw SOAP XML response

Sterpu Victor
In reply to this post by Martin Gainty
I tired your code but I got a problem. This is what I wrote(I don't have a axis2.xml file, I just create the stub with wsdl2java and used the class):
ConfigurationContext configContext = ConfigurationContextFactory.createDefaultConfigurationContext();
ServiceClient sender = new ServiceClient(configContext, null);
OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);
MessageContext response=mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
String response_xml = response.getEnvelope().toString();

These lines are executed immediatly after the succesful SOAP call and I receive a java.lang.NullPointerException at the line "String response_xml = response.getEnvelope().toString();".
I traced the SOAP response with Fiddler and the answer is "<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><dlwmin:storeClinicalDocumentSResponse xmlns:dlwmin="core.des.uti.ro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><return></return></dlwmin:storeClinicalDocumentSResponse></soapenv:Body></soapenv:Envelope>"
 
Thank you.
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
To: "[hidden email]" <[hidden email]>; "Sterpu Victor" <[hidden email]>
Sent: 2/11/2016 9:28:48 PM
Subject: Re: Re[2]: Raw SOAP XML response
 



From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 2, 2016 11:57 AM
To: Martin Gainty; [hidden email]
Subject: Re[2]: Raw SOAP XML response
 
It didn't work.
This is what I did: I deleted from the directory of Axis2\lib 4 files: axiom-jaxb-1.2.19.jar, axiom-api-1.2.19.jar, axiom-dom-1.2.19.jar, axiom-impl-1.2.19.jar
and I added these 4 files: axiom-api-1.2.20.jar,axiom-dom-1.2.20.jar,axiom-impl-1.2.20.jar,axiom-jaxb-1.2.20.jar.
I use Axis embeded so I also deleted from my netbeans libraries the old jars and added the new ones.
I recompiled and the error remained.
 
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
To: "[hidden email]" <[hidden email]>; "Sterpu Victor" <[hidden email]>
Sent: 2/11/2016 4:58:09 PM
Subject: Re: Raw SOAP XML response
 

possible outdated version of axiom


     * In Axiom versions prior to 1.2.9, the sequence of events was inconsistent if the
     * underlying stream is XOP encoded and caching is disabled (see WSCOMMONS-485).
     * This made it necessary for the caller to (partially) handle the XOP processing and to use
     * {@link OMAttachmentAccessor#getDataHandler(String)} to retrieve the binary content.
     * Starting with 1.2.9 this is no longer be the case: as specified above,
     * the sequence of events is *independent of the state of the object model*
     * and the value of the <code>cache</code> parameter,
     * and ALL binary content is reported through the
     * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} (embedded in axiom-api) extension.

upgrade axiom to 1.2.9 a recompile, package, deploy and run with 1.2.9 should mitigate the error you are now receiving

*please keep us apprised*


Martin
______________________________________________



From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 2, 2016 9:37 AM
To: [hidden email]
Subject: Raw SOAP XML response
 
Hello
 
I need to save the raw SOAP XML response from Axis2(I use axis 2 1.7.3).
When Axis2 call retusrns an error this code works: 
String response = sc.getLastOperationContext().getMessageContext("In").getEnvelope().toString();

MG>//build configurationContext from location of repo and name of axis2.xml
MG> ConfigurationContext configContext = ConfigurationContextFactory
.createConfigurationContextFromFileSystem("../../repository",  //exact location of repository
"axis2.xml");                           //exact filename of axis2.xml

MG>establish new ServiceClient implementing attributes from ConfigurationContext
MG> ServiceClient sender = new ServiceClient(configContext, null);

MG>you will need to supply a QName for incoming request and SOAP response output
/**
     * Operation name used for an anonymous in-out operation (meaning we sent a message and receive
     * a response, equivalent to a WSDL In-Out operation).
     
    public static final QName ANON_OUT_IN_OP = new QName(Constants.AXIS2_NAMESPACE_URI,
                                                         "anonOutInOp",
                                                         Constants.AXIS2_NAMESPACE_PREFIX);
*/
MG>OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP); 

MG>ask client to contact axis2 server and pull a response back
MG>MessageContext response=mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE));
/**
     *MESSAGE_LABEL_IN_VALUE Constant to represent the message label "In" which is used by the
     * following WSDL 2.0 defined MEPs: In-Only, Robust In-Only, In-Out, //Hint: In-Out is your Message Exchange
     * In-Optional-Out, Out-In, Out-Optional-In.
    public static final byte MESSAGE_LABEL_IN = 0;
    public static final String MESSAGE_LABEL_IN_VALUE = "In";
*/

MG>convert soapEnvelope to String
MG>String response =response.getEnvelope().toString();

MG>?
But when I run a succesful Axis2 call the same code gives the following error: "java.lang.IllegalStateException: Can't process next node because caching is disabled"
 
I tryed to enable cache like this, but it didn't work:
 
                                ServiceClient sc = (ServiceClient)method_getServiceClient.invoke(objectReflect);
                                ServiceContext srv_context = sc.getServiceContext();
                                srv_context.setCachingOperationContext(true);
                                OperationContext oc= new OperationContext(); 
                                oc.setComplete(true); 
                                srv_context.setLastOperationContext(oc);
 
Thank you

 
Reply | Threaded
Open this post in threaded view
|

Re: Re[4]: Raw SOAP XML response

Martin Gainty

if you dont have axis2.xml in server config do you have annotations defined in server code?

http://www.ibm.com/developerworks/library/j-jws8/

www.ibm.com
Apache Axis2 supports a range of data-binding technologies, including the official Java standard, JAXB 2.x. Axis2 also supports the Java standard for Web service configuration, JAX-WS 2.x, as an alternative to its own custom configuration technique. Dennis Sosnoski continues his Java Web services column series by demonstrating how you can use each of these Java standards with Axis2 and discussing some of the limitations of Axis2's current support for them.



do you have a Axis2 Server fully operational.. what does Axis Happiness page say?


http://localhost:8080/axis2-web/HappyAxis.jsp


Martin
______________________________________________




From: Sterpu Victor <[hidden email]>
Sent: Monday, November 14, 2016 4:58 PM
To: Martin Gainty; [hidden email]
Subject: Re[4]: Raw SOAP XML response
 
I tired your code but I got a problem. This is what I wrote(I don't have a axis2.xml file, I just create the stub with wsdl2java and used the class):
ConfigurationContext configContext = ConfigurationContextFactory.createDefaultConfigurationContext();
ServiceClient sender = new ServiceClient(configContext, null);
OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);
MessageContext response=mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
String response_xml = response.getEnvelope().toString();

These lines are executed immediatly after the succesful SOAP call and I receive a java.lang.NullPointerException at the line "String response_xml = response.getEnvelope().toString();".
I traced the SOAP response with Fiddler and the answer is "<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><dlwmin:storeClinicalDocumentSResponse xmlns:dlwmin="core.des.uti.ro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><return></return></dlwmin:storeClinicalDocumentSResponse></soapenv:Body></soapenv:Envelope>"
 
Thank you.
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
To: "[hidden email]" <[hidden email]>; "Sterpu Victor" <[hidden email]>
Sent: 2/11/2016 9:28:48 PM
Subject: Re: Re[2]: Raw SOAP XML response
 



From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 2, 2016 11:57 AM
To: Martin Gainty; [hidden email]
Subject: Re[2]: Raw SOAP XML response
 
It didn't work.
This is what I did: I deleted from the directory of Axis2\lib 4 files: axiom-jaxb-1.2.19.jar, axiom-api-1.2.19.jar, axiom-dom-1.2.19.jar, axiom-impl-1.2.19.jar
and I added these 4 files: axiom-api-1.2.20.jar,axiom-dom-1.2.20.jar,axiom-impl-1.2.20.jar,axiom-jaxb-1.2.20.jar.
I use Axis embeded so I also deleted from my netbeans libraries the old jars and added the new ones.
I recompiled and the error remained.
 
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
To: "[hidden email]" <[hidden email]>; "Sterpu Victor" <[hidden email]>
Sent: 2/11/2016 4:58:09 PM
Subject: Re: Raw SOAP XML response
 

possible outdated version of axiom


     * In Axiom versions prior to 1.2.9, the sequence of events was inconsistent if the
     * underlying stream is XOP encoded and caching is disabled (see WSCOMMONS-485).
     * This made it necessary for the caller to (partially) handle the XOP processing and to use
     * {@link OMAttachmentAccessor#getDataHandler(String)} to retrieve the binary content.
     * Starting with 1.2.9 this is no longer be the case: as specified above,
     * the sequence of events is *independent of the state of the object model*
     * and the value of the <code>cache</code> parameter,
     * and ALL binary content is reported through the
     * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} (embedded in axiom-api) extension.

upgrade axiom to 1.2.9 a recompile, package, deploy and run with 1.2.9 should mitigate the error you are now receiving

*please keep us apprised*


Martin
______________________________________________



From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 2, 2016 9:37 AM
To: [hidden email]
Subject: Raw SOAP XML response
 
Hello
 
I need to save the raw SOAP XML response from Axis2(I use axis 2 1.7.3).
When Axis2 call retusrns an error this code works: 
String response = sc.getLastOperationContext().getMessageContext("In").getEnvelope().toString();

MG>//build configurationContext from location of repo and name of axis2.xml
MG> ConfigurationContext configContext = ConfigurationContextFactory
.createConfigurationContextFromFileSystem("../../repository",  //exact location of repository
"axis2.xml");                           //exact filename of axis2.xml

MG>establish new ServiceClient implementing attributes from ConfigurationContext
MG> ServiceClient sender = new ServiceClient(configContext, null);

MG>you will need to supply a QName for incoming request and SOAP response output
/**
     * Operation name used for an anonymous in-out operation (meaning we sent a message and receive
     * a response, equivalent to a WSDL In-Out operation).
     
    public static final QName ANON_OUT_IN_OP = new QName(Constants.AXIS2_NAMESPACE_URI,
                                                         "anonOutInOp",
                                                         Constants.AXIS2_NAMESPACE_PREFIX);
*/
MG>OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP); 

MG>ask client to contact axis2 server and pull a response back
MG>MessageContext response=mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE));
/**
     *MESSAGE_LABEL_IN_VALUE Constant to represent the message label "In" which is used by the
     * following WSDL 2.0 defined MEPs: In-Only, Robust In-Only, In-Out, //Hint: In-Out is your Message Exchange
     * In-Optional-Out, Out-In, Out-Optional-In.
    public static final byte MESSAGE_LABEL_IN = 0;
    public static final String MESSAGE_LABEL_IN_VALUE = "In";
*/

MG>convert soapEnvelope to String
MG>String response =response.getEnvelope().toString();

MG>?
But when I run a succesful Axis2 call the same code gives the following error: "java.lang.IllegalStateException: Can't process next node because caching is disabled"
 
I tryed to enable cache like this, but it didn't work:
 
                                ServiceClient sc = (ServiceClient)method_getServiceClient.invoke(objectReflect);
                                ServiceContext srv_context = sc.getServiceContext();
                                srv_context.setCachingOperationContext(true);
                                OperationContext oc= new OperationContext(); 
                                oc.setComplete(true); 
                                srv_context.setLastOperationContext(oc);
 
Thank you

 
Reply | Threaded
Open this post in threaded view
|

Re: Re[4]: Raw SOAP XML response

Martin Gainty



Martin Gainty
______________________________________________
 _____ _          _____             _          _____     ___ _                        _____               _     _   _          |_   _| |_ ___   |  _  |___ ___ ___| |_ ___   |   __|___|  _| |_ _ _ _ ___ ___ ___   |   __|___ _ _ ___ _| |___| |_|_|___ ___    | | |   | -_|  |     | . | .'|  _|   | -_|  |__   | . |  _|  _| | | | .'|  _| -_|  |   __| . | | |   | . | .'|  _| | . |   |   |_| |_|_|___|  |__|__|  _|__,|___|_|_|___|  |_____|___|_| |_| |_____|__,|_| |___|  |__|  |___|___|_|_|___|__,|_| |_|___|_|_|                        |_|                                                                                                    




From: Martin Gainty <[hidden email]>
Sent: Tuesday, November 15, 2016 6:46 AM
To: [hidden email]; Sterpu Victor
Subject: Re: Re[4]: Raw SOAP XML response
 

if you dont have axis2.xml in server config do you have annotations defined in server code?

http://www.ibm.com/developerworks/library/j-jws8/

www.ibm.com
Apache Axis2 supports a range of data-binding technologies, including the official Java standard, JAXB 2.x. Axis2 also supports the Java standard for Web service configuration, JAX-WS 2.x, as an alternative to its own custom configuration technique. Dennis Sosnoski continues his Java Web services column series by demonstrating how you can use each of these Java standards with Axis2 and discussing some of the limitations of Axis2's current support for them.



do you have a Axis2 Server fully operational.. what does Axis Happiness page say?


http://localhost:8080/axis2-web/HappyAxis.jsp


MG>http://ServerHostName:ServerPortNumber/axis2/axis2-web/HappyAxis.jsp


Martin
______________________________________________




From: Sterpu Victor <[hidden email]>
Sent: Monday, November 14, 2016 4:58 PM
To: Martin Gainty; [hidden email]
Subject: Re[4]: Raw SOAP XML response
 
I tired your code but I got a problem. This is what I wrote(I don't have a axis2.xml file, I just create the stub with wsdl2java and used the class):
ConfigurationContext configContext = ConfigurationContextFactory.createDefaultConfigurationContext();
ServiceClient sender = new ServiceClient(configContext, null);
OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);
MessageContext response=mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
String response_xml = response.getEnvelope().toString();

These lines are executed immediatly after the succesful SOAP call and I receive a java.lang.NullPointerException at the line "String response_xml = response.getEnvelope().toString();".
I traced the SOAP response with Fiddler and the answer is "<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><dlwmin:storeClinicalDocumentSResponse xmlns:dlwmin="core.des.uti.ro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><return></return></dlwmin:storeClinicalDocumentSResponse></soapenv:Body></soapenv:Envelope>"
 
Thank you.
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
To: "[hidden email]" <[hidden email]>; "Sterpu Victor" <[hidden email]>
Sent: 2/11/2016 9:28:48 PM
Subject: Re: Re[2]: Raw SOAP XML response
 



From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 2, 2016 11:57 AM
To: Martin Gainty; [hidden email]
Subject: Re[2]: Raw SOAP XML response
 
It didn't work.
This is what I did: I deleted from the directory of Axis2\lib 4 files: axiom-jaxb-1.2.19.jar, axiom-api-1.2.19.jar, axiom-dom-1.2.19.jar, axiom-impl-1.2.19.jar
and I added these 4 files: axiom-api-1.2.20.jar,axiom-dom-1.2.20.jar,axiom-impl-1.2.20.jar,axiom-jaxb-1.2.20.jar.
I use Axis embeded so I also deleted from my netbeans libraries the old jars and added the new ones.
I recompiled and the error remained.
 
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
To: "[hidden email]" <[hidden email]>; "Sterpu Victor" <[hidden email]>
Sent: 2/11/2016 4:58:09 PM
Subject: Re: Raw SOAP XML response
 

possible outdated version of axiom


     * In Axiom versions prior to 1.2.9, the sequence of events was inconsistent if the
     * underlying stream is XOP encoded and caching is disabled (see WSCOMMONS-485).
     * This made it necessary for the caller to (partially) handle the XOP processing and to use
     * {@link OMAttachmentAccessor#getDataHandler(String)} to retrieve the binary content.
     * Starting with 1.2.9 this is no longer be the case: as specified above,
     * the sequence of events is *independent of the state of the object model*
     * and the value of the <code>cache</code> parameter,
     * and ALL binary content is reported through the
     * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} (embedded in axiom-api) extension.

upgrade axiom to 1.2.9 a recompile, package, deploy and run with 1.2.9 should mitigate the error you are now receiving

*please keep us apprised*


Martin
______________________________________________



From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 2, 2016 9:37 AM
To: [hidden email]
Subject: Raw SOAP XML response
 
Hello
 
I need to save the raw SOAP XML response from Axis2(I use axis 2 1.7.3).
When Axis2 call retusrns an error this code works: 
String response = sc.getLastOperationContext().getMessageContext("In").getEnvelope().toString();

MG>//build configurationContext from location of repo and name of axis2.xml
MG> ConfigurationContext configContext = ConfigurationContextFactory
.createConfigurationContextFromFileSystem("../../repository",  //exact location of repository
"axis2.xml");                           //exact filename of axis2.xml

MG>establish new ServiceClient implementing attributes from ConfigurationContext
MG> ServiceClient sender = new ServiceClient(configContext, null);

MG>you will need to supply a QName for incoming request and SOAP response output
/**
     * Operation name used for an anonymous in-out operation (meaning we sent a message and receive
     * a response, equivalent to a WSDL In-Out operation).
     
    public static final QName ANON_OUT_IN_OP = new QName(Constants.AXIS2_NAMESPACE_URI,
                                                         "anonOutInOp",
                                                         Constants.AXIS2_NAMESPACE_PREFIX);
*/
MG>OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP); 

MG>ask client to contact axis2 server and pull a response back
MG>MessageContext response=mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE));
/**
     *MESSAGE_LABEL_IN_VALUE Constant to represent the message label "In" which is used by the
     * following WSDL 2.0 defined MEPs: In-Only, Robust In-Only, In-Out, //Hint: In-Out is your Message Exchange
     * In-Optional-Out, Out-In, Out-Optional-In.
    public static final byte MESSAGE_LABEL_IN = 0;
    public static final String MESSAGE_LABEL_IN_VALUE = "In";
*/

MG>convert soapEnvelope to String
MG>String response =response.getEnvelope().toString();

MG>?
But when I run a succesful Axis2 call the same code gives the following error: "java.lang.IllegalStateException: Can't process next node because caching is disabled"
 
I tryed to enable cache like this, but it didn't work:
 
                                ServiceClient sc = (ServiceClient)method_getServiceClient.invoke(objectReflect);
                                ServiceContext srv_context = sc.getServiceContext();
                                srv_context.setCachingOperationContext(true);
                                OperationContext oc= new OperationContext(); 
                                oc.setComplete(true); 
                                srv_context.setLastOperationContext(oc);
 
Thank you

 
Reply | Threaded
Open this post in threaded view
|

Re[6]: Raw SOAP XML response

Sterpu Victor
I don't have a Axis2 server at all, the server is not implemented by me, I just want to use a Axis2 client.
This is why I don't have axis2.xml. :)
 
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
Sent: 16/11/2016 3:07:55 AM
Subject: Re: Re[4]: Raw SOAP XML response
 



Martin Gainty
______________________________________________
 _____ _          _____             _          _____     ___ _                        _____               _     _   _          |_   _| |_ ___   |  _  |___ ___ ___| |_ ___   |   __|___|  _| |_ _ _ _ ___ ___ ___   |   __|___ _ _ ___ _| |___| |_|_|___ ___    | | |   | -_|  |     | . | .'|  _|   | -_|  |__   | . |  _|  _| | | | .'|  _| -_|  |   __| . | | |   | . | .'|  _| | . |   |   |_| |_|_|___|  |__|__|  _|__,|___|_|_|___|  |_____|___|_| |_| |_____|__,|_| |___|  |__|  |___|___|_|_|___|__,|_| |_|___|_|_|                        |_|                                                                                                    




From: Martin Gainty <[hidden email]>
Sent: Tuesday, November 15, 2016 6:46 AM
To: [hidden email]; Sterpu Victor
Subject: Re: Re[4]: Raw SOAP XML response
 

if you dont have axis2.xml in server config do you have annotations defined in server code?

http://www.ibm.com/developerworks/library/j-jws8/

Apache Axis2 supports a range of data-binding technologies, including the official Java standard, JAXB 2.x. Axis2 also supports the Java standard for Web service configuration, JAX-WS 2.x, as an alternative to its own custom configuration technique. Dennis Sosnoski continues his Java Web services column series by demonstrating how you can use each of these Java standards with Axis2 and discussing some of the limitations of Axis2's current support for them.



do you have a Axis2 Server fully operational.. what does Axis Happiness page say?


http://localhost:8080/axis2-web/HappyAxis.jsp


MG>http://ServerHostName:ServerPortNumber/axis2/axis2-web/HappyAxis.jsp


Martin
______________________________________________




From: Sterpu Victor <[hidden email]>
Sent: Monday, November 14, 2016 4:58 PM
To: Martin Gainty; [hidden email]
Subject: Re[4]: Raw SOAP XML response
 
I tired your code but I got a problem. This is what I wrote(I don't have a axis2.xml file, I just create the stub with wsdl2java and used the class):
ConfigurationContext configContext = ConfigurationContextFactory.createDefaultConfigurationContext();
ServiceClient sender = new ServiceClient(configContext, null);
OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);
MessageContext response=mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
String response_xml = response.getEnvelope().toString();

These lines are executed immediatly after the succesful SOAP call and I receive a java.lang.NullPointerException at the line "String response_xml = response.getEnvelope().toString();".
I traced the SOAP response with Fiddler and the answer is "<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><dlwmin:storeClinicalDocumentSResponse xmlns:dlwmin="core.des.uti.ro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><return></return></dlwmin:storeClinicalDocumentSResponse></soapenv:Body></soapenv:Envelope>"
 
Thank you.
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
To: "[hidden email]" <[hidden email]>; "Sterpu Victor" <[hidden email]>
Sent: 2/11/2016 9:28:48 PM
Subject: Re: Re[2]: Raw SOAP XML response
 



From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 2, 2016 11:57 AM
To: Martin Gainty; [hidden email]
Subject: Re[2]: Raw SOAP XML response
 
It didn't work.
This is what I did: I deleted from the directory of Axis2\lib 4 files: axiom-jaxb-1.2.19.jar, axiom-api-1.2.19.jar, axiom-dom-1.2.19.jar, axiom-impl-1.2.19.jar
and I added these 4 files: axiom-api-1.2.20.jar,axiom-dom-1.2.20.jar,axiom-impl-1.2.20.jar,axiom-jaxb-1.2.20.jar.
I use Axis embeded so I also deleted from my netbeans libraries the old jars and added the new ones.
I recompiled and the error remained.
 
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
To: "[hidden email]" <[hidden email]>; "Sterpu Victor" <[hidden email]>
Sent: 2/11/2016 4:58:09 PM
Subject: Re: Raw SOAP XML response
 

possible outdated version of axiom


     * In Axiom versions prior to 1.2.9, the sequence of events was inconsistent if the
     * underlying stream is XOP encoded and caching is disabled (see WSCOMMONS-485).
     * This made it necessary for the caller to (partially) handle the XOP processing and to use
     * {@link OMAttachmentAccessor#getDataHandler(String)} to retrieve the binary content.
     * Starting with 1.2.9 this is no longer be the case: as specified above,
     * the sequence of events is *independent of the state of the object model*
     * and the value of the <code>cache</code> parameter,
     * and ALL binary content is reported through the
     * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} (embedded in axiom-api) extension.

upgrade axiom to 1.2.9 a recompile, package, deploy and run with 1.2.9 should mitigate the error you are now receiving

*please keep us apprised*


Martin
______________________________________________



From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 2, 2016 9:37 AM
To: [hidden email]
Subject: Raw SOAP XML response
 
Hello
 
I need to save the raw SOAP XML response from Axis2(I use axis 2 1.7.3).
When Axis2 call retusrns an error this code works: 
String response = sc.getLastOperationContext().getMessageContext("In").getEnvelope().toString();

MG>//build configurationContext from location of repo and name of axis2.xml
MG> ConfigurationContext configContext = ConfigurationContextFactory
.createConfigurationContextFromFileSystem("../../repository",  //exact location of repository
"axis2.xml");                           //exact filename of axis2.xml

MG>establish new ServiceClient implementing attributes from ConfigurationContext
MG> ServiceClient sender = new ServiceClient(configContext, null);

MG>you will need to supply a QName for incoming request and SOAP response output
/**
     * Operation name used for an anonymous in-out operation (meaning we sent a message and receive
     * a response, equivalent to a WSDL In-Out operation).
     
    public static final QName ANON_OUT_IN_OP = new QName(Constants.AXIS2_NAMESPACE_URI,
                                                         "anonOutInOp",
                                                         Constants.AXIS2_NAMESPACE_PREFIX);
*/
MG>OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP); 

MG>ask client to contact axis2 server and pull a response back
MG>MessageContext response=mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE));
/**
     *MESSAGE_LABEL_IN_VALUE Constant to represent the message label "In" which is used by the
     * following WSDL 2.0 defined MEPs: In-Only, Robust In-Only, In-Out, //Hint: In-Out is your Message Exchange
     * In-Optional-Out, Out-In, Out-Optional-In.
    public static final byte MESSAGE_LABEL_IN = 0;
    public static final String MESSAGE_LABEL_IN_VALUE = "In";
*/

MG>convert soapEnvelope to String
MG>String response =response.getEnvelope().toString();

MG>?
But when I run a succesful Axis2 call the same code gives the following error: "java.lang.IllegalStateException: Can't process next node because caching is disabled"
 
I tryed to enable cache like this, but it didn't work:
 
                                ServiceClient sc = (ServiceClient)method_getServiceClient.invoke(objectReflect);
                                ServiceContext srv_context = sc.getServiceContext();
                                srv_context.setCachingOperationContext(true);
                                OperationContext oc= new OperationContext(); 
                                oc.setComplete(true); 
                                srv_context.setLastOperationContext(oc);
 
Thank you

 
Reply | Threaded
Open this post in threaded view
|

Re: Re[6]: Raw SOAP XML response

Martin Gainty

nothing we can do to mitigate if we dont know the status of the Axis2 Server


feel free to pass this information to Axis2 ServerAdmin and have them contact us for assistance


mulţumesc


Martin
______________________________________________




From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 16, 2016 6:50 AM
To: [hidden email]; [hidden email]
Subject: Re[6]: Raw SOAP XML response
 
I don't have a Axis2 server at all, the server is not implemented by me, I just want to use a Axis2 client.
This is why I don't have axis2.xml. :)
 
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
Sent: 16/11/2016 3:07:55 AM
Subject: Re: Re[4]: Raw SOAP XML response
 



Martin Gainty
______________________________________________
 _____ _          _____             _          _____     ___ _                        _____               _     _   _          |_   _| |_ ___   |  _  |___ ___ ___| |_ ___   |   __|___|  _| |_ _ _ _ ___ ___ ___   |   __|___ _ _ ___ _| |___| |_|_|___ ___    | | |   | -_|  |     | . | .'|  _|   | -_|  |__   | . |  _|  _| | | | .'|  _| -_|  |   __| . | | |   | . | .'|  _| | . |   |   |_| |_|_|___|  |__|__|  _|__,|___|_|_|___|  |_____|___|_| |_| |_____|__,|_| |___|  |__|  |___|___|_|_|___|__,|_| |_|___|_|_|                        |_|                                                                                                    




From: Martin Gainty <[hidden email]>
Sent: Tuesday, November 15, 2016 6:46 AM
To: [hidden email]; Sterpu Victor
Subject: Re: Re[4]: Raw SOAP XML response
 

if you dont have axis2.xml in server config do you have annotations defined in server code?

http://www.ibm.com/developerworks/library/j-jws8/

Apache Axis2 supports a range of data-binding technologies, including the official Java standard, JAXB 2.x. Axis2 also supports the Java standard for Web service configuration, JAX-WS 2.x, as an alternative to its own custom configuration technique. Dennis Sosnoski continues his Java Web services column series by demonstrating how you can use each of these Java standards with Axis2 and discussing some of the limitations of Axis2's current support for them.



do you have a Axis2 Server fully operational.. what does Axis Happiness page say?


http://localhost:8080/axis2-web/HappyAxis.jsp


MG>http://ServerHostName:ServerPortNumber/axis2/axis2-web/HappyAxis.jsp


Martin
______________________________________________




From: Sterpu Victor <[hidden email]>
Sent: Monday, November 14, 2016 4:58 PM
To: Martin Gainty; [hidden email]
Subject: Re[4]: Raw SOAP XML response
 
I tired your code but I got a problem. This is what I wrote(I don't have a axis2.xml file, I just create the stub with wsdl2java and used the class):
ConfigurationContext configContext = ConfigurationContextFactory.createDefaultConfigurationContext();
ServiceClient sender = new ServiceClient(configContext, null);
OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);
MessageContext response=mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
String response_xml = response.getEnvelope().toString();

These lines are executed immediatly after the succesful SOAP call and I receive a java.lang.NullPointerException at the line "String response_xml = response.getEnvelope().toString();".
I traced the SOAP response with Fiddler and the answer is "<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><dlwmin:storeClinicalDocumentSResponse xmlns:dlwmin="core.des.uti.ro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><return></return></dlwmin:storeClinicalDocumentSResponse></soapenv:Body></soapenv:Envelope>"
 
Thank you.
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
To: "[hidden email]" <[hidden email]>; "Sterpu Victor" <[hidden email]>
Sent: 2/11/2016 9:28:48 PM
Subject: Re: Re[2]: Raw SOAP XML response
 



From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 2, 2016 11:57 AM
To: Martin Gainty; [hidden email]
Subject: Re[2]: Raw SOAP XML response
 
It didn't work.
This is what I did: I deleted from the directory of Axis2\lib 4 files: axiom-jaxb-1.2.19.jar, axiom-api-1.2.19.jar, axiom-dom-1.2.19.jar, axiom-impl-1.2.19.jar
and I added these 4 files: axiom-api-1.2.20.jar,axiom-dom-1.2.20.jar,axiom-impl-1.2.20.jar,axiom-jaxb-1.2.20.jar.
I use Axis embeded so I also deleted from my netbeans libraries the old jars and added the new ones.
I recompiled and the error remained.
 
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
To: "[hidden email]" <[hidden email]>; "Sterpu Victor" <[hidden email]>
Sent: 2/11/2016 4:58:09 PM
Subject: Re: Raw SOAP XML response
 

possible outdated version of axiom


     * In Axiom versions prior to 1.2.9, the sequence of events was inconsistent if the
     * underlying stream is XOP encoded and caching is disabled (see WSCOMMONS-485).
     * This made it necessary for the caller to (partially) handle the XOP processing and to use
     * {@link OMAttachmentAccessor#getDataHandler(String)} to retrieve the binary content.
     * Starting with 1.2.9 this is no longer be the case: as specified above,
     * the sequence of events is *independent of the state of the object model*
     * and the value of the <code>cache</code> parameter,
     * and ALL binary content is reported through the
     * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} (embedded in axiom-api) extension.

upgrade axiom to 1.2.9 a recompile, package, deploy and run with 1.2.9 should mitigate the error you are now receiving

*please keep us apprised*


Martin
______________________________________________



From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 2, 2016 9:37 AM
To: [hidden email]
Subject: Raw SOAP XML response
 
Hello
 
I need to save the raw SOAP XML response from Axis2(I use axis 2 1.7.3).
When Axis2 call retusrns an error this code works: 
String response = sc.getLastOperationContext().getMessageContext("In").getEnvelope().toString();

MG>//build configurationContext from location of repo and name of axis2.xml
MG> ConfigurationContext configContext = ConfigurationContextFactory
.createConfigurationContextFromFileSystem("../../repository",  //exact location of repository
"axis2.xml");                           //exact filename of axis2.xml

MG>establish new ServiceClient implementing attributes from ConfigurationContext
MG> ServiceClient sender = new ServiceClient(configContext, null);

MG>you will need to supply a QName for incoming request and SOAP response output
/**
     * Operation name used for an anonymous in-out operation (meaning we sent a message and receive
     * a response, equivalent to a WSDL In-Out operation).
     
    public static final QName ANON_OUT_IN_OP = new QName(Constants.AXIS2_NAMESPACE_URI,
                                                         "anonOutInOp",
                                                         Constants.AXIS2_NAMESPACE_PREFIX);
*/
MG>OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP); 

MG>ask client to contact axis2 server and pull a response back
MG>MessageContext response=mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE));
/**
     *MESSAGE_LABEL_IN_VALUE Constant to represent the message label "In" which is used by the
     * following WSDL 2.0 defined MEPs: In-Only, Robust In-Only, In-Out, //Hint: In-Out is your Message Exchange
     * In-Optional-Out, Out-In, Out-Optional-In.
    public static final byte MESSAGE_LABEL_IN = 0;
    public static final String MESSAGE_LABEL_IN_VALUE = "In";
*/

MG>convert soapEnvelope to String
MG>String response =response.getEnvelope().toString();

MG>?
But when I run a succesful Axis2 call the same code gives the following error: "java.lang.IllegalStateException: Can't process next node because caching is disabled"
 
I tryed to enable cache like this, but it didn't work:
 
                                ServiceClient sc = (ServiceClient)method_getServiceClient.invoke(objectReflect);
                                ServiceContext srv_context = sc.getServiceContext();
                                srv_context.setCachingOperationContext(true);
                                OperationContext oc= new OperationContext(); 
                                oc.setComplete(true); 
                                srv_context.setLastOperationContext(oc);
 
Thank you

 
Reply | Threaded
Open this post in threaded view
|

Re: Re[6]: Raw SOAP XML response

Andreas Veithen-2
Stop talking nonsense, Martin. He's having an issue on the client side, and it doesn't matter what is running on the server side.

As I pointed out earlier, once the response has been consumed, you can no longer serialize it, and that explains the error.

Andreas

On Wed, Nov 16, 2016 at 2:31 PM, Martin Gainty <[hidden email]> wrote:

nothing we can do to mitigate if we dont know the status of the Axis2 Server


feel free to pass this information to Axis2 ServerAdmin and have them contact us for assistance


mulţumesc


Martin
______________________________________________




From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 16, 2016 6:50 AM
To: [hidden email]; [hidden email]
Subject: Re[6]: Raw SOAP XML response
 
I don't have a Axis2 server at all, the server is not implemented by me, I just want to use a Axis2 client.
This is why I don't have axis2.xml. :)
 
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
Sent: 16/11/2016 3:07:55 AM
Subject: Re: Re[4]: Raw SOAP XML response
 



Martin Gainty
______________________________________________
 _____ _          _____             _          _____     ___ _                        _____               _     _   _          |_   _| |_ ___   |  _  |___ ___ ___| |_ ___   |   __|___|  _| |_ _ _ _ ___ ___ ___   |   __|___ _ _ ___ _| |___| |_|_|___ ___    | | |   | -_|  |     | . | .'|  _|   | -_|  |__   | . |  _|  _| | | | .'|  _| -_|  |   __| . | | |   | . | .'|  _| | . |   |   |_| |_|_|___|  |__|__|  _|__,|___|_|_|___|  |_____|___|_| |_| |_____|__,|_| |___|  |__|  |___|___|_|_|___|__,|_| |_|___|_|_|                        |_|                                                                                                    




From: Martin Gainty <[hidden email]>
Sent: Tuesday, November 15, 2016 6:46 AM
To: [hidden email]; Sterpu Victor
Subject: Re: Re[4]: Raw SOAP XML response
 

if you dont have axis2.xml in server config do you have annotations defined in server code?

http://www.ibm.com/developerworks/library/j-jws8/

Apache Axis2 supports a range of data-binding technologies, including the official Java standard, JAXB 2.x. Axis2 also supports the Java standard for Web service configuration, JAX-WS 2.x, as an alternative to its own custom configuration technique. Dennis Sosnoski continues his Java Web services column series by demonstrating how you can use each of these Java standards with Axis2 and discussing some of the limitations of Axis2's current support for them.



do you have a Axis2 Server fully operational.. what does Axis Happiness page say?


http://localhost:8080/axis2-web/HappyAxis.jsp


MG>http://ServerHostName:ServerPortNumber/axis2/axis2-web/HappyAxis.jsp


Martin
______________________________________________




From: Sterpu Victor <[hidden email]>
Sent: Monday, November 14, 2016 4:58 PM
To: Martin Gainty; [hidden email]
Subject: Re[4]: Raw SOAP XML response
 
I tired your code but I got a problem. This is what I wrote(I don't have a axis2.xml file, I just create the stub with wsdl2java and used the class):
ConfigurationContext configContext = ConfigurationContextFactory.createDefaultConfigurationContext();
ServiceClient sender = new ServiceClient(configContext, null);
OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP);
MessageContext response=mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
String response_xml = response.getEnvelope().toString();

These lines are executed immediatly after the succesful SOAP call and I receive a java.lang.NullPointerException at the line "String response_xml = response.getEnvelope().toString();".
I traced the SOAP response with Fiddler and the answer is "<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><dlwmin:storeClinicalDocumentSResponse xmlns:dlwmin="core.des.uti.ro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><return></return></dlwmin:storeClinicalDocumentSResponse></soapenv:Body></soapenv:Envelope>"
 
Thank you.
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
To: "[hidden email]" <[hidden email]>; "Sterpu Victor" <[hidden email]>
Sent: 2/11/2016 9:28:48 PM
Subject: Re: Re[2]: Raw SOAP XML response
 



From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 2, 2016 11:57 AM
To: Martin Gainty; [hidden email]
Subject: Re[2]: Raw SOAP XML response
 
It didn't work.
This is what I did: I deleted from the directory of Axis2\lib 4 files: axiom-jaxb-1.2.19.jar, axiom-api-1.2.19.jar, axiom-dom-1.2.19.jar, axiom-impl-1.2.19.jar
and I added these 4 files: axiom-api-1.2.20.jar,axiom-dom-1.2.20.jar,axiom-impl-1.2.20.jar,axiom-jaxb-1.2.20.jar.
I use Axis embeded so I also deleted from my netbeans libraries the old jars and added the new ones.
I recompiled and the error remained.
 
 
------ Original Message ------
From: "Martin Gainty" <[hidden email]>
To: "[hidden email]" <[hidden email]>; "Sterpu Victor" <[hidden email]>
Sent: 2/11/2016 4:58:09 PM
Subject: Re: Raw SOAP XML response
 

possible outdated version of axiom


     * In Axiom versions prior to 1.2.9, the sequence of events was inconsistent if the
     * underlying stream is XOP encoded and caching is disabled (see WSCOMMONS-485).
     * This made it necessary for the caller to (partially) handle the XOP processing and to use
     * {@link OMAttachmentAccessor#getDataHandler(String)} to retrieve the binary content.
     * Starting with 1.2.9 this is no longer be the case: as specified above,
     * the sequence of events is *independent of the state of the object model*
     * and the value of the <code>cache</code> parameter,
     * and ALL binary content is reported through the
     * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} (embedded in axiom-api) extension.

upgrade axiom to 1.2.9 a recompile, package, deploy and run with 1.2.9 should mitigate the error you are now receiving

*please keep us apprised*


Martin
______________________________________________



From: Sterpu Victor <[hidden email]>
Sent: Wednesday, November 2, 2016 9:37 AM
To: [hidden email]
Subject: Raw SOAP XML response
 
Hello
 
I need to save the raw SOAP XML response from Axis2(I use axis 2 1.7.3).
When Axis2 call retusrns an error this code works: 
String response = sc.getLastOperationContext().getMessageContext("In").getEnvelope().toString();

MG>//build configurationContext from location of repo and name of axis2.xml
MG> ConfigurationContext configContext = ConfigurationContextFactory
.createConfigurationContextFromFileSystem("../../repository",  //exact location of repository
"axis2.xml");                           //exact filename of axis2.xml

MG>establish new ServiceClient implementing attributes from ConfigurationContext
MG> ServiceClient sender = new ServiceClient(configContext, null);

MG>you will need to supply a QName for incoming request and SOAP response output
/**
     * Operation name used for an anonymous in-out operation (meaning we sent a message and receive
     * a response, equivalent to a WSDL In-Out operation).
     
    public static final QName ANON_OUT_IN_OP = new QName(Constants.AXIS2_NAMESPACE_URI,
                                                         "anonOutInOp",
                                                         Constants.AXIS2_NAMESPACE_PREFIX);
*/
MG>OperationClient mepClient = sender.createClient(ServiceClient.ANON_OUT_IN_OP); 

MG>ask client to contact axis2 server and pull a response back
MG>MessageContext response=mepClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE));
/**
     *MESSAGE_LABEL_IN_VALUE Constant to represent the message label "In" which is used by the
     * following WSDL 2.0 defined MEPs: In-Only, Robust In-Only, In-Out, //Hint: In-Out is your Message Exchange
     * In-Optional-Out, Out-In, Out-Optional-In.
    public static final byte MESSAGE_LABEL_IN = 0;
    public static final String MESSAGE_LABEL_IN_VALUE = "In";
*/

MG>convert soapEnvelope to String
MG>String response =response.getEnvelope().toString();

MG>?
But when I run a succesful Axis2 call the same code gives the following error: "java.lang.IllegalStateException: Can't process next node because caching is disabled"
 
I tryed to enable cache like this, but it didn't work:
 
                                ServiceClient sc = (ServiceClient)method_getServiceClient.invoke(objectReflect);
                                ServiceContext srv_context = sc.getServiceContext();
                                srv_context.setCachingOperationContext(true);
                                OperationContext oc= new OperationContext(); 
                                oc.setComplete(true); 
                                srv_context.setLastOperationContext(oc);
 
Thank you