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 Tony Fang <to...@gmail.com> on 2006/11/12 12:57:00 UTC

[Axis2][SOAP]Can not output XML declaration, after other output has already been done.

Hi, there.

I always get the exception like "org.apache.axis2.AxisFault: Can not output
XML declaration, after other output has already been done.; nested exception
is: " when I try to run the following code. Does some one also meet this
AxisFault before?

you can find the Web Service here, both WSDL file, and SOAP Request and
Response sample. (I am sure, I can get the response when I using Axis1.1)

Any commonts would help me.

Thanks
Tony

---- Flowing the test code ----------------


package tony.axis.test;

import org.apache.axiom.om.*;
import org.apache.axiom.soap.*;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.*;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.MessageContextConstants;
import org.apache.axis2.client.async.*;

public class SoapTest2 {

 public static void main(String[] args) {

  //String url = "http://www.xignite.com/xFutures.asmx/GetFutureSymbol";
  String url ="http://www.xignite.com/services/GetFutureSymbol";

  Options options = new Options();
  //options.setProperty(MessageContextConstants.CHUNKED,
Constants.VALUE_FALSE);
  options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
  options.setTo(new EndpointReference(url));


  try {
   ServiceClient serviceClient = new ServiceClient();
   serviceClient.setOptions(options);
   SOAPFactory omFactory = OMAbstractFactory.getSOAP11Factory();
         SOAPEnvelope envelope = omFactory.getDefaultEnvelope();
   OMNamespace xsi = omFactory.createOMNamespace("
http://www.w3.org/2001/XMLSchema-instance", "xsi");
   OMNamespace xsd = omFactory.createOMNamespace("
http://www.w3.org/2001/XMLSchema", "xsd");
   OMNamespace soap = omFactory.createOMNamespace("
http://schemas.xmlsoap.org/soap/envelope/", "soap");
   OMNamespace defNs = omFactory.createOMNamespace("
http://www.xignite.com/services/", "");
   OMNamespace nullNs = omFactory.createOMNamespace("", "");

   OMElement operation =
                omFactory.createOMElement("GetFutureSymbol",
                        "",
                        "");
   operation.setNamespace(defNs);

   SOAPHeader header = envelope.getHeader();
   SOAPBody body = envelope.getBody();
   body.addChild(operation);

   envelope.setNamespace(xsi);
   envelope.setNamespace(xsd);
   envelope.setNamespace(soap);

   OMElement username = omFactory.createOMElement("Username", nullNs);
   username.setText("");
   header.addChild(username);
   OMElement password = omFactory.createOMElement("Password", nullNs);
   password.setText("");
   header.addChild(password);
   OMElement tracer = omFactory.createOMElement("Tracer", nullNs);
   tracer.setText("");
   header.addChild(tracer);
   OMElement symbol = omFactory.createOMElement("Symbol", nullNs);
   symbol.setText("CL");
   operation.addChild(symbol);
   OMElement month = omFactory.createOMElement("Month", nullNs);
   month.setText("9");
   operation.addChild(month);
   OMElement year = omFactory.createOMElement("Year", nullNs);
   year.setText("2002");
   operation.addChild(year);

   System.out.println(envelope);
   OMElement result = serviceClient.sendReceive(envelope);
   System.out.print(result);

  } catch (AxisFault e1) {
   System.out.println("AxisFault");
   System.out.println(e1.getFaultRole());
   e1.printStackTrace();
  }
 }
}

Re: [Axis2][SOAP]Can not output XML declaration, after other output has already been done.

Posted by Paul Fremantle <pz...@gmail.com>.
Also, can you please use TCPMON to capture the actual request/response
that you are getting from Axis2.

Paul

On 11/12/06, Paul Fremantle <pz...@gmail.com> wrote:
> Tony
>
> I can't see the SOAP response. Can you please repost it?
>
> Ta
> Paul
>
> On 11/12/06, Tony Fang <to...@gmail.com> wrote:
> > Hi, there.
> >
> > I always get the exception like "org.apache.axis2.AxisFault: Can not output
> > XML declaration, after other output has already been done.; nested exception
> > is: " when I try to run the following code. Does some one also meet this
> > AxisFault before?
> >
> > you can find the Web Service here, both WSDL file, and SOAP Request and
> > Response sample. (I am sure, I can get the response when I using Axis1.1)
> >
> > Any commonts would help me.
> >
> > Thanks
> > Tony
> >
> > ---- Flowing the test code ----------------
> >
> >
> >
> > package tony.axis.test;
> >
> > import org.apache.axiom.om.*;
> > import org.apache.axiom.soap.*;
> > import org.apache.axis2.AxisFault;
> > import org.apache.axis2.Constants;
> > import org.apache.axis2.addressing.EndpointReference;
> > import org.apache.axis2.client.* ;
> > import org.apache.axis2.context.MessageContext;
> > import org.apache.axis2.context.MessageContextConstants;
> > import org.apache.axis2.client.async.*;
> >
> > public class SoapTest2 {
> >
> >  public static void main(String[] args) {
> >
> >   //String url =
> > "http://www.xignite.com/xFutures.asmx/GetFutureSymbol";
> >   String url ="
> > http://www.xignite.com/services/GetFutureSymbol";
> >
> >   Options options = new Options();
> >
> > //options.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE);
> >   options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> >   options.setTo(new EndpointReference(url));
> >
> >
> >   try {
> >    ServiceClient serviceClient = new ServiceClient();
> >    serviceClient.setOptions(options);
> >    SOAPFactory omFactory =
> > OMAbstractFactory.getSOAP11Factory();
> >          SOAPEnvelope envelope = omFactory.getDefaultEnvelope ();
> >    OMNamespace xsi =
> > omFactory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance",
> > "xsi");
> >    OMNamespace xsd = omFactory.createOMNamespace
> > ("http://www.w3.org/2001/XMLSchema", "xsd");
> >    OMNamespace soap = omFactory.createOMNamespace("
> > http://schemas.xmlsoap.org/soap/envelope/", "soap");
> >    OMNamespace defNs =
> > omFactory.createOMNamespace("http://www.xignite.com/services/",
> > "");
> >    OMNamespace nullNs = omFactory.createOMNamespace("", "");
> >
> >    OMElement operation =
> >                 omFactory.createOMElement("GetFutureSymbol",
> >                         "",
> >                         "");
> >    operation.setNamespace(defNs);
> >
> >    SOAPHeader header = envelope.getHeader();
> >    SOAPBody body = envelope.getBody();
> >    body.addChild(operation);
> >
> >    envelope.setNamespace(xsi);
> >    envelope.setNamespace(xsd);
> >    envelope.setNamespace(soap);
> >
> >    OMElement username = omFactory.createOMElement("Username", nullNs);
> >    username.setText("");
> >    header.addChild(username);
> >    OMElement password = omFactory.createOMElement("Password", nullNs);
> >    password.setText("");
> >    header.addChild(password);
> >    OMElement tracer = omFactory.createOMElement("Tracer", nullNs);
> >    tracer.setText("");
> >    header.addChild(tracer);
> >    OMElement symbol = omFactory.createOMElement("Symbol", nullNs);
> >    symbol.setText("CL");
> >    operation.addChild(symbol);
> >    OMElement month = omFactory.createOMElement("Month", nullNs);
> >    month.setText("9");
> >    operation.addChild(month);
> >    OMElement year = omFactory.createOMElement("Year", nullNs);
> >    year.setText("2002");
> >    operation.addChild(year);
> >
> >    System.out.println(envelope);
> >    OMElement result = serviceClient.sendReceive(envelope);
> >    System.out.print(result);
> >
> >   } catch (AxisFault e1) {
> >    System.out.println("AxisFault");
> >    System.out.println(e1.getFaultRole());
> >    e1.printStackTrace();
> >   }
> >  }
> > }
> >
>
>
> --
> Paul Fremantle
> VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
>
> http://bloglines.com/blog/paulfremantle
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>


-- 
Paul Fremantle
VP/Technology, WSO2 and OASIS WS-RX TC Co-chair

http://bloglines.com/blog/paulfremantle
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: [Axis2][SOAP]Can not output XML declaration, after other output has already been done.

Posted by Tony Fang <to...@gmail.com>.
HI, Paul

you can find the all the related source here.
http://www.xignite.com/xFutures.asmx/GetFutureSymbol

the response should like

   <?xml version="1.0" encoding="utf-8" ?>
<FutureSymbol xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns="
http://www.xignite.com/services/">
  <Outcome>Success</Outcome>
  <Identity>IP</Identity>
  <Delay>0</Delay>
  <FutureSymbol>CLU2</FutureSymbol>
  <CommoditySymbol>CL</CommoditySymbol>
  <Year>2002</Year>
  <Month>9</Month>
  </FutureSymbol>



2006/11/12, Paul Fremantle <pz...@gmail.com>:
>
> Tony
>
> I can't see the SOAP response. Can you please repost it?
>
> Ta
> Paul
>
> On 11/12/06, Tony Fang <to...@gmail.com> wrote:
> > Hi, there.
> >
> > I always get the exception like "org.apache.axis2.AxisFault: Can not
> output
> > XML declaration, after other output has already been done.; nested
> exception
> > is: " when I try to run the following code. Does some one also meet this
> > AxisFault before?
> >
> > you can find the Web Service here, both WSDL file, and SOAP Request and
> > Response sample. (I am sure, I can get the response when I using Axis1.1
> )
> >
> > Any commonts would help me.
> >
> > Thanks
> > Tony
> >
> > ---- Flowing the test code ----------------
> >
> >
> >
> > package tony.axis.test;
> >
> > import org.apache.axiom.om.*;
> > import org.apache.axiom.soap.*;
> > import org.apache.axis2.AxisFault;
> > import org.apache.axis2.Constants;
> > import org.apache.axis2.addressing.EndpointReference;
> > import org.apache.axis2.client.* ;
> > import org.apache.axis2.context.MessageContext;
> > import org.apache.axis2.context.MessageContextConstants;
> > import org.apache.axis2.client.async.*;
> >
> > public class SoapTest2 {
> >
> >  public static void main(String[] args) {
> >
> >   //String url =
> > "http://www.xignite.com/xFutures.asmx/GetFutureSymbol";
> >   String url ="
> > http://www.xignite.com/services/GetFutureSymbol";
> >
> >   Options options = new Options();
> >
> > //options.setProperty(MessageContextConstants.CHUNKED,
> Constants.VALUE_FALSE);
> >   options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> >   options.setTo(new EndpointReference(url));
> >
> >
> >   try {
> >    ServiceClient serviceClient = new ServiceClient();
> >    serviceClient.setOptions(options);
> >    SOAPFactory omFactory =
> > OMAbstractFactory.getSOAP11Factory();
> >          SOAPEnvelope envelope = omFactory.getDefaultEnvelope ();
> >    OMNamespace xsi =
> > omFactory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance",
> > "xsi");
> >    OMNamespace xsd = omFactory.createOMNamespace
> > ("http://www.w3.org/2001/XMLSchema", "xsd");
> >    OMNamespace soap = omFactory.createOMNamespace("
> > http://schemas.xmlsoap.org/soap/envelope/", "soap");
> >    OMNamespace defNs =
> > omFactory.createOMNamespace("http://www.xignite.com/services/",
> > "");
> >    OMNamespace nullNs = omFactory.createOMNamespace("", "");
> >
> >    OMElement operation =
> >                 omFactory.createOMElement("GetFutureSymbol",
> >                         "",
> >                         "");
> >    operation.setNamespace(defNs);
> >
> >    SOAPHeader header = envelope.getHeader();
> >    SOAPBody body = envelope.getBody();
> >    body.addChild(operation);
> >
> >    envelope.setNamespace(xsi);
> >    envelope.setNamespace(xsd);
> >    envelope.setNamespace(soap);
> >
> >    OMElement username = omFactory.createOMElement("Username", nullNs);
> >    username.setText("");
> >    header.addChild(username);
> >    OMElement password = omFactory.createOMElement("Password", nullNs);
> >    password.setText("");
> >    header.addChild(password);
> >    OMElement tracer = omFactory.createOMElement("Tracer", nullNs);
> >    tracer.setText("");
> >    header.addChild(tracer);
> >    OMElement symbol = omFactory.createOMElement("Symbol", nullNs);
> >    symbol.setText("CL");
> >    operation.addChild(symbol);
> >    OMElement month = omFactory.createOMElement("Month", nullNs);
> >    month.setText("9");
> >    operation.addChild(month);
> >    OMElement year = omFactory.createOMElement("Year", nullNs);
> >    year.setText("2002");
> >    operation.addChild(year);
> >
> >    System.out.println(envelope);
> >    OMElement result = serviceClient.sendReceive(envelope);
> >    System.out.print(result);
> >
> >   } catch (AxisFault e1) {
> >    System.out.println("AxisFault");
> >    System.out.println(e1.getFaultRole());
> >    e1.printStackTrace();
> >   }
> >  }
> > }
> >
>
>
> --
> Paul Fremantle
> VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
>
> http://bloglines.com/blog/paulfremantle
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Regards
Tony

Re: [Axis2][SOAP]Can not output XML declaration, after other output has already been done.

Posted by Paul Fremantle <pz...@gmail.com>.
Tony

I can't see the SOAP response. Can you please repost it?

Ta
Paul

On 11/12/06, Tony Fang <to...@gmail.com> wrote:
> Hi, there.
>
> I always get the exception like "org.apache.axis2.AxisFault: Can not output
> XML declaration, after other output has already been done.; nested exception
> is: " when I try to run the following code. Does some one also meet this
> AxisFault before?
>
> you can find the Web Service here, both WSDL file, and SOAP Request and
> Response sample. (I am sure, I can get the response when I using Axis1.1)
>
> Any commonts would help me.
>
> Thanks
> Tony
>
> ---- Flowing the test code ----------------
>
>
>
> package tony.axis.test;
>
> import org.apache.axiom.om.*;
> import org.apache.axiom.soap.*;
> import org.apache.axis2.AxisFault;
> import org.apache.axis2.Constants;
> import org.apache.axis2.addressing.EndpointReference;
> import org.apache.axis2.client.* ;
> import org.apache.axis2.context.MessageContext;
> import org.apache.axis2.context.MessageContextConstants;
> import org.apache.axis2.client.async.*;
>
> public class SoapTest2 {
>
>  public static void main(String[] args) {
>
>   //String url =
> "http://www.xignite.com/xFutures.asmx/GetFutureSymbol";
>   String url ="
> http://www.xignite.com/services/GetFutureSymbol";
>
>   Options options = new Options();
>
> //options.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE);
>   options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
>   options.setTo(new EndpointReference(url));
>
>
>   try {
>    ServiceClient serviceClient = new ServiceClient();
>    serviceClient.setOptions(options);
>    SOAPFactory omFactory =
> OMAbstractFactory.getSOAP11Factory();
>          SOAPEnvelope envelope = omFactory.getDefaultEnvelope ();
>    OMNamespace xsi =
> omFactory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance",
> "xsi");
>    OMNamespace xsd = omFactory.createOMNamespace
> ("http://www.w3.org/2001/XMLSchema", "xsd");
>    OMNamespace soap = omFactory.createOMNamespace("
> http://schemas.xmlsoap.org/soap/envelope/", "soap");
>    OMNamespace defNs =
> omFactory.createOMNamespace("http://www.xignite.com/services/",
> "");
>    OMNamespace nullNs = omFactory.createOMNamespace("", "");
>
>    OMElement operation =
>                 omFactory.createOMElement("GetFutureSymbol",
>                         "",
>                         "");
>    operation.setNamespace(defNs);
>
>    SOAPHeader header = envelope.getHeader();
>    SOAPBody body = envelope.getBody();
>    body.addChild(operation);
>
>    envelope.setNamespace(xsi);
>    envelope.setNamespace(xsd);
>    envelope.setNamespace(soap);
>
>    OMElement username = omFactory.createOMElement("Username", nullNs);
>    username.setText("");
>    header.addChild(username);
>    OMElement password = omFactory.createOMElement("Password", nullNs);
>    password.setText("");
>    header.addChild(password);
>    OMElement tracer = omFactory.createOMElement("Tracer", nullNs);
>    tracer.setText("");
>    header.addChild(tracer);
>    OMElement symbol = omFactory.createOMElement("Symbol", nullNs);
>    symbol.setText("CL");
>    operation.addChild(symbol);
>    OMElement month = omFactory.createOMElement("Month", nullNs);
>    month.setText("9");
>    operation.addChild(month);
>    OMElement year = omFactory.createOMElement("Year", nullNs);
>    year.setText("2002");
>    operation.addChild(year);
>
>    System.out.println(envelope);
>    OMElement result = serviceClient.sendReceive(envelope);
>    System.out.print(result);
>
>   } catch (AxisFault e1) {
>    System.out.println("AxisFault");
>    System.out.println(e1.getFaultRole());
>    e1.printStackTrace();
>   }
>  }
> }
>


-- 
Paul Fremantle
VP/Technology, WSO2 and OASIS WS-RX TC Co-chair

http://bloglines.com/blog/paulfremantle
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: [Axis2][SOAP]Can not output XML declaration, after other output has already been done.

Posted by Tony Fang <to...@gmail.com>.
Yes, I find I
   Used wrong URL, and I should send the Operation instead of send whole
SOAP Envelope.

Thanks
Tony


2006/11/13, Paul Fremantle <pz...@gmail.com>:
>
> Tony
>
> The URL you are using is not a SOAP endpoint URL.
>
> Maybe that is what is wrong!?
>
> Paul
>
> On 11/12/06, Tony Fang <to...@gmail.com> wrote:
> > Hi, there.
> >
> > I always get the exception like "org.apache.axis2.AxisFault: Can not
> output
> > XML declaration, after other output has already been done.; nested
> exception
> > is: " when I try to run the following code. Does some one also meet this
> > AxisFault before?
> >
> > you can find the Web Service here, both WSDL file, and SOAP Request and
> > Response sample. (I am sure, I can get the response when I using Axis1.1
> )
> >
> > Any commonts would help me.
> >
> > Thanks
> > Tony
> >
> > ---- Flowing the test code ----------------
> >
> >
> >
> > package tony.axis.test;
> >
> > import org.apache.axiom.om.*;
> > import org.apache.axiom.soap.*;
> > import org.apache.axis2.AxisFault;
> > import org.apache.axis2.Constants;
> > import org.apache.axis2.addressing.EndpointReference;
> > import org.apache.axis2.client.* ;
> > import org.apache.axis2.context.MessageContext;
> > import org.apache.axis2.context.MessageContextConstants;
> > import org.apache.axis2.client.async.*;
> >
> > public class SoapTest2 {
> >
> >  public static void main(String[] args) {
> >
> >   //String url =
> > "http://www.xignite.com/xFutures.asmx/GetFutureSymbol";
> >   String url ="
> > http://www.xignite.com/services/GetFutureSymbol";
> >
> >   Options options = new Options();
> >
> > //options.setProperty(MessageContextConstants.CHUNKED,
> Constants.VALUE_FALSE);
> >   options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> >   options.setTo(new EndpointReference(url));
> >
> >
> >   try {
> >    ServiceClient serviceClient = new ServiceClient();
> >    serviceClient.setOptions(options);
> >    SOAPFactory omFactory =
> > OMAbstractFactory.getSOAP11Factory();
> >          SOAPEnvelope envelope = omFactory.getDefaultEnvelope ();
> >    OMNamespace xsi =
> > omFactory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance",
> > "xsi");
> >    OMNamespace xsd = omFactory.createOMNamespace
> > ("http://www.w3.org/2001/XMLSchema", "xsd");
> >    OMNamespace soap = omFactory.createOMNamespace("
> > http://schemas.xmlsoap.org/soap/envelope/", "soap");
> >    OMNamespace defNs =
> > omFactory.createOMNamespace("http://www.xignite.com/services/",
> > "");
> >    OMNamespace nullNs = omFactory.createOMNamespace("", "");
> >
> >    OMElement operation =
> >                 omFactory.createOMElement("GetFutureSymbol",
> >                         "",
> >                         "");
> >    operation.setNamespace(defNs);
> >
> >    SOAPHeader header = envelope.getHeader();
> >    SOAPBody body = envelope.getBody();
> >    body.addChild(operation);
> >
> >    envelope.setNamespace(xsi);
> >    envelope.setNamespace(xsd);
> >    envelope.setNamespace(soap);
> >
> >    OMElement username = omFactory.createOMElement("Username", nullNs);
> >    username.setText("");
> >    header.addChild(username);
> >    OMElement password = omFactory.createOMElement("Password", nullNs);
> >    password.setText("");
> >    header.addChild(password);
> >    OMElement tracer = omFactory.createOMElement("Tracer", nullNs);
> >    tracer.setText("");
> >    header.addChild(tracer);
> >    OMElement symbol = omFactory.createOMElement("Symbol", nullNs);
> >    symbol.setText("CL");
> >    operation.addChild(symbol);
> >    OMElement month = omFactory.createOMElement("Month", nullNs);
> >    month.setText("9");
> >    operation.addChild(month);
> >    OMElement year = omFactory.createOMElement("Year", nullNs);
> >    year.setText("2002");
> >    operation.addChild(year);
> >
> >    System.out.println(envelope);
> >    OMElement result = serviceClient.sendReceive(envelope);
> >    System.out.print(result);
> >
> >   } catch (AxisFault e1) {
> >    System.out.println("AxisFault");
> >    System.out.println(e1.getFaultRole());
> >    e1.printStackTrace();
> >   }
> >  }
> > }
> >
>
>
> --
> Paul Fremantle
> VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
>
> http://bloglines.com/blog/paulfremantle
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Regards
Tony

Re: [Axis2][SOAP]Can not output XML declaration, after other output has already been done.

Posted by Paul Fremantle <pz...@gmail.com>.
Tony

The URL you are using is not a SOAP endpoint URL.

Maybe that is what is wrong!?

Paul

On 11/12/06, Tony Fang <to...@gmail.com> wrote:
> Hi, there.
>
> I always get the exception like "org.apache.axis2.AxisFault: Can not output
> XML declaration, after other output has already been done.; nested exception
> is: " when I try to run the following code. Does some one also meet this
> AxisFault before?
>
> you can find the Web Service here, both WSDL file, and SOAP Request and
> Response sample. (I am sure, I can get the response when I using Axis1.1)
>
> Any commonts would help me.
>
> Thanks
> Tony
>
> ---- Flowing the test code ----------------
>
>
>
> package tony.axis.test;
>
> import org.apache.axiom.om.*;
> import org.apache.axiom.soap.*;
> import org.apache.axis2.AxisFault;
> import org.apache.axis2.Constants;
> import org.apache.axis2.addressing.EndpointReference;
> import org.apache.axis2.client.* ;
> import org.apache.axis2.context.MessageContext;
> import org.apache.axis2.context.MessageContextConstants;
> import org.apache.axis2.client.async.*;
>
> public class SoapTest2 {
>
>  public static void main(String[] args) {
>
>   //String url =
> "http://www.xignite.com/xFutures.asmx/GetFutureSymbol";
>   String url ="
> http://www.xignite.com/services/GetFutureSymbol";
>
>   Options options = new Options();
>
> //options.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE);
>   options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
>   options.setTo(new EndpointReference(url));
>
>
>   try {
>    ServiceClient serviceClient = new ServiceClient();
>    serviceClient.setOptions(options);
>    SOAPFactory omFactory =
> OMAbstractFactory.getSOAP11Factory();
>          SOAPEnvelope envelope = omFactory.getDefaultEnvelope ();
>    OMNamespace xsi =
> omFactory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance",
> "xsi");
>    OMNamespace xsd = omFactory.createOMNamespace
> ("http://www.w3.org/2001/XMLSchema", "xsd");
>    OMNamespace soap = omFactory.createOMNamespace("
> http://schemas.xmlsoap.org/soap/envelope/", "soap");
>    OMNamespace defNs =
> omFactory.createOMNamespace("http://www.xignite.com/services/",
> "");
>    OMNamespace nullNs = omFactory.createOMNamespace("", "");
>
>    OMElement operation =
>                 omFactory.createOMElement("GetFutureSymbol",
>                         "",
>                         "");
>    operation.setNamespace(defNs);
>
>    SOAPHeader header = envelope.getHeader();
>    SOAPBody body = envelope.getBody();
>    body.addChild(operation);
>
>    envelope.setNamespace(xsi);
>    envelope.setNamespace(xsd);
>    envelope.setNamespace(soap);
>
>    OMElement username = omFactory.createOMElement("Username", nullNs);
>    username.setText("");
>    header.addChild(username);
>    OMElement password = omFactory.createOMElement("Password", nullNs);
>    password.setText("");
>    header.addChild(password);
>    OMElement tracer = omFactory.createOMElement("Tracer", nullNs);
>    tracer.setText("");
>    header.addChild(tracer);
>    OMElement symbol = omFactory.createOMElement("Symbol", nullNs);
>    symbol.setText("CL");
>    operation.addChild(symbol);
>    OMElement month = omFactory.createOMElement("Month", nullNs);
>    month.setText("9");
>    operation.addChild(month);
>    OMElement year = omFactory.createOMElement("Year", nullNs);
>    year.setText("2002");
>    operation.addChild(year);
>
>    System.out.println(envelope);
>    OMElement result = serviceClient.sendReceive(envelope);
>    System.out.print(result);
>
>   } catch (AxisFault e1) {
>    System.out.println("AxisFault");
>    System.out.println(e1.getFaultRole());
>    e1.printStackTrace();
>   }
>  }
> }
>


-- 
Paul Fremantle
VP/Technology, WSO2 and OASIS WS-RX TC Co-chair

http://bloglines.com/blog/paulfremantle
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org