0

I have seen a similar issue here but unfortunately not the same Problem.

I am sending a soap request to a SoapUI Mock service via Java code (Using Axis2 libraries, generated from a WSDL with WSDL2Java). While debugging i got the complete response body as expected. Somehow when running the code normally without stopping breakpoints, i receive an empty response!!

I have already tried adding Thread.sleep() and Thread.yield() as suggested in similar issues, but still no positive result.

as long as i stop in a breakpoint after the execute and before reading the envelope (initializing _returnMessageContext), i got the expected result.

Any Idea how to solve this??

Thanks in advance.

Here is a code snippet:

        org.apache.axis2.context.MessageContext _messageContext = null;
          try{
           org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
          _operationClient.getOptions().setAction("\"\"");
          _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);

          
          
              addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&");
          

          // create a message context
          _messageContext = new org.apache.axis2.context.MessageContext();

          

          // create SOAP envelope with that payload
          org.apache.axiom.soap.SOAPEnvelope env = null;
                
                                                
                                                env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
                                                pruefstatusAnfrageRequest12,
                                                optimizeContent(new javax.xml.namespace.QName("****",
                                                "****")));
                                            
    //adding SOAP soap_headers
     _serviceClient.addHeadersToEnvelope(env);
    // set the message context with that soap envelope
    _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();
            
                            java.lang.Object object = fromOM(
                                         _returnEnv.getBody().getFirstElement() ,
                                         ***ResponseE.class,
                                          getEnvelopeNamespaces(_returnEnv));

                           
                                    return (****ResponseE)object;
Feras
  • 1

0 Answers0