cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1056
Views
3
Helpful
5
Replies

Log RAW AXL Messages

r.rung
Level 1
Level 1

Hello Developer Community,

let's assume i use the Cisco AXL Sample application in Java and i want to log the RAW AXL Requests and Response Messages to console.

is there a nice way to do this?

1 Accepted Solution

Accepted Solutions
5 Replies 5

npetrele
Cisco Employee
Cisco Employee

This is actually a Java issue that doesn't have anything to do with AXL.  But here's how I print the XML for test AXL apps:

        //Create a String writer object which will be

        //used to write jaxbElment XML to string

        StringWriter writer = new StringWriter();

        // create JAXBContext which will be used to update writer

        JAXBContext context = JAXBContext.newInstance(XFkType.class);

        // marshall or convert jaxbElement containing student to xml format

        context.createMarshaller().marshal(jaxbReq, writer);

   

        //print XML string representation of object

        System.out.println( writer.toString() );

I picked up this tip ages ago from Stackoverflow.  That's a great resource for things like this. 

If you were referring to the sample app included in the AXL SQL Toolkit, it appears to use SOAPConnection to make the call:

SOAPConnection (Java Platform SE 7 )

SOAPConnection accepts/returns the complete request/response info as SOAPMessage:

SOAPMessage (Java Platform SE 7 )

You should be able to use the .writeTo() method of SOAPMessage to get a dump of the request/response, or use the more specific getters (e.g. .getSOAPHeader() ) to inspect the request/response.

More generally/flexibly, you might look into using a man-in-the-middle/proxy tool like Fiddler, which can let you inspect the actual HTTP packets being sent on the wire.

Hello Nicholas and dstaudt,

thank you for your answers, well in general this might work but i'm not sure if this applys to the way the Cisco AXL Demo Application builds the Request.

i can't find any getter like .getSOAPHeader() or .writeTo() for the Classes that i get from the AXL SQL Toolkit.

this is how my code looks at the moment:

com.cisco.axlapiservice._10_5.AXLAPIService axlService = new com.cisco.axlapiservice._10_5.AXLAPIService();

com.cisco.axlapiservice._10_5.AXLPort axlPort = axlService.getAXLPort();

// Set the URL, user, and password on the JAX-WS client

String validatorUrl = "https://" + cluster.getUcHost() + ":8443/axl/";

((BindingProvider) axlPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, validatorUrl);

((BindingProvider) axlPort).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, cluster.getUcAdmin());

((BindingProvider) axlPort).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, cluster.getUcPswd());

// Make a synchronous call to the UpgradeValid service

com.cisco.axl.api._10.GetPhoneReq axlParams = new com.cisco.axl.api._10.GetPhoneReq();

axlParams.setName(phoneName);

com.cisco.axl.api._10.GetPhoneRes getPhoneResponse = null;

           

    try {

        getPhoneResponse = axlPort.getPhone(axlParams);

        } catch (AXLError e) {

        e.printStackTrace();

        }

           

loggingInfo("\n\n\n ************************* \nCUCM Version: " +cluster.getCucmVersion());

loggingInfo("Product=" + getPhoneResponse.getReturn().getPhone().getProduct());

loggingInfo("Device Pool=" + getPhoneResponse.getReturn().getPhone().getDevicePoolName().getValue());

loggingInfo("Description=" + getPhoneResponse.getReturn().getPhone().getDescription());

loggingInfo("Class=" + getPhoneResponse.getReturn().getClass().getName());

Perhaps this thread may be applicable for tracing JAX-WS: java - Tracing XML request/responses with JAX-WS - Stack Overflow

thanks a lot dstaudt,

putting in the setSystemProperties from the link

System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true");
System.setProperty("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", "true");
System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true");

System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true");

prints all to console, which is exactly what i wanted.

you are right, fiddler is also really awesome for troubleshooting axl requestst, but fiddler is not in all customer environments allowed.