Hi,
      I had modified my code  and i am getting nullpointer Exception if i place 
the following code before invoke method.

MessageContext context =call.getMessageContext();
 SOAPMessage soapMessage =context.getMessage();
 System.out.println("SOAPMessage"+ soapMessage.getSOAPBody().toString());

      If i place this code after invoke method, i am getting  SOAP Response 
message. But my intension to track SOAP Request XML . How can i do this one.

Thanks ,
ram
  

Upul Godage <[EMAIL PROTECTED]> wrote: Hi,

org.apache.axis.client.Call does have the method call.getMessageContext() but 
not in javax.xml.rpc.Call interface, I think. You can also get response message 
directly.
call.getResponseMessage().writeTo(System.out);
 
Upul


On Wed, Mar 5, 2008 at 12:05 AM, Seetha Rama Krishna <[EMAIL PROTECTED]> wrote:
 Hi Vipul,
        thanks for your reply. 
  call.getMessageContext().getMessage().writeTo(System.out);   is not working, 
because getMessageContext() is not a method in Call Interface. 
       Here is my complete code which is available with axis distribution 
chapter5
  /*
 * Copyright 2001-2004 The Apache Software Foundation.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
  * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an  "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
   package samples.userguide.example5;
  import org.apache.axis.AxisFault;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.utils.Options;
   import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
                                           
public class Client
{
    public static void main(String [] args) throws Exception
    {
         Options options =  new Options(args);
        
        Order order = new Order();
        order.setCustomerName("Glen Daniels");
        order.setShippingAddress("275 Grove Street, Newton, MA");
        
         String [] items = new String[] { "mp3jukebox", "1600mahBattery" };
        int [] quantities = new int [] { 1, 4 };
        
        order.setItemCodes(items);
        order.setQuantities(quantities);
         
        Service  service = new Service();
        Call      call    = (Call) service.createCall();
        QName    qn      = new QName( "urn:BeanService", "Order" );
          call.registerTypeMapping(Order.class, qn,
                      new 
org.apache.axis.encoding.ser.BeanSerializerFactory(Order.class, qn),        
                       new 
org.apache.axis.encoding.ser.BeanDeserializerFactory(Order.class, qn));        
        String result;
        try {
             call.setTargetEndpointAddress( new java.net.URL(options.getURL()) 
);
            call.setOperationName( new QName("OrderProcessor", "processOrder") 
);
            call.addParameter( "arg1", qn, ParameterMode.IN );
             call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING );
              result = (String) call.invoke( new Object[] { order } );
        } catch (AxisFault fault) {
            result = "Error : " + fault.toString();
         }
        
        System.out.println(result);
     }
}

   
   
  Thanks,
  Ram

  

Michael Lambert <[EMAIL PROTECTED]> wrote:
   Upul Godage wrote:   Hi,

String ret = (String) call.invoke( new Object[] { textToSend } );
 
call.getMessageContext().getMessage().writeTo(System.out); // Writes to the 
given OutputStream

Upul

  On Tue, Mar 4, 2008 at 3:33 PM, Seetha Rama Krishna <[EMAIL PROTECTED]> wrote:
   Hi,
     I deployed the sample code  which is distributed by axis, I just wanted to 
see the SOAP Request message through programming.  
     I had done this through TCPMON.  I need to check it through programming. 
How can i do this.   I tried to modify the code Client code for MyService 
webservice.
 

MessageContext mc = new MessageContext(null);
System.out.println(mc.getAxisEngine());
 String ret = (String) call.invoke( new Object[] { textToSend } );
             
System.out.println(AxisEngine.getCurrentMessageContext().getRequestMessage());
 
   I am getting nullpointer Exception when i run this code. 
             By using TCPMonitor, i need to check the SOAP Request Messages and 
Response message of Remote  webservice.
                How can i do this



          


  Thanks & Regards,
 Krishna

  
  
---------------------------------
  Now you can chat without downloading messenger. Click here to know how. 

I use a simple customer module that I configured through axis2.xml:


import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axis2.AxisFault;
import  org.apache.axis2.context.MessageContext;
import org.apache.axis2.handlers.AbstractHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Simple handler that logs the contents of SOAPs messages to INFO via 
  * the jakarta commons logging package.
 * 
 * Handler typically is configured to capture messages passing through
 * either the IN or OUT phases of Axis2.  To register the handler enter an 
 * xml element similar to the one below in your axis2.xml:
  * 
 *         <phaseOrder type="InFlow">
 *              ...
 *            <phase name="userMonitorPhase">
 *                <handler  name="SOAPSniffer"
 *                    class="com.fry.axis2.module.SOAPSnifferHandler">
 *                    <order phase="userMonitorPhase"/>
 *                </handler>
  *            </phase>
 *            ...
 *        </phaseOrder>
 * 
 * @author foo
 *
 */
public class SOAPSnifferHandler extends AbstractHandler {    
    
    private Log log = LogFactory.getLog(getClass());
     
    public InvocationResponse invoke(MessageContext context) throws  AxisFault {
        
        SOAPEnvelope envelope = context.getEnvelope();
        
        log.info( envelope.toString() );
        
        return InvocationResponse.CONTINUE;
    }
}
 


          

---------------------------------
 Bring your gang together - do your thing.  Start your group.

 

       
---------------------------------
 Bring your gang together - do your thing.  Start your group.

Reply via email to