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 Seetha Rama Krishna <ra...@yahoo.co.in> on 2008/03/04 11:03:17 UTC
SOAPRequest
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.
Re: SOAPRequest
Posted by Seetha Rama Krishna <ra...@yahoo.co.in>.
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);
}
}
Michael Lambert <ma...@gmail.com> 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 <ra...@yahoo.co.in> 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;
}
}
Thanks & Regards,
Krishna
---------------------------------
Forgot the famous last words? Access your message archive online. Click here.
Re: Client handler tutorial
Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi Chau,
Are you referring to Axis2 ?
if so there is no difference between client side and server side.
Thank you!
Deepal
>
> Anybody knows the link to client handler tutorial?
>
> Thanks
>
> ------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Client handler tutorial
Posted by "Chau, Hoang" <Ho...@adp.com>.
Hi,
Anybody knows the link to client handler tutorial?
Thanks
-----------------------------------------
This message and any attachments are intended only for the use of
the addressee and may contain information that is privileged and
confidential. If the reader of the message is not the intended
recipient or an authorized representative of the intended
recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this
communication in error, notify the sender immediately by return
email and delete the message and any attachments from your system.
Re: SOAPRequest
Posted by Michael Lambert <ma...@gmail.com>.
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
> <ram_kurra@yahoo.co.in <ma...@yahoo.co.in>> 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
> <http://in.rd.yahoo.com/tagline_webmessenger_5/*http://in.messenger.yahoo.com/webmessengerpromo.php>
> 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;
}
}
Re: SOAPRequest
Posted by Upul Godage <up...@gmail.com>.
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 <ra...@yahoo.co.in>
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<http://in.rd.yahoo.com/tagline_webmessenger_5/*http://in.messenger.yahoo.com/webmessengerpromo.php>to know how.