HI, Paul
you can find the all the related source here.
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>
<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 <[EMAIL PROTECTED]>:
Tony
I can't see the SOAP response. Can you please repost it?
Ta
Paul
On 11/12/06, Tony Fang < [EMAIL PROTECTED]> 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
[EMAIL PROTECTED]
"Oxygenating the Web Service Platform", www.wso2.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Regards
Tony