axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davanum Srinivas (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (AXIS2-247) calling the .Net webservice from Axis2 client resulting in javax.xml.stream.XMLStreamException
Date Thu, 30 Mar 2006 19:25:26 GMT
     [ http://issues.apache.org/jira/browse/AXIS2-247?page=all ]
     
Davanum Srinivas resolved AXIS2-247:
------------------------------------

    Resolution: Fixed

Please try latest 0.95.

thanks,
dims

> calling the .Net webservice from Axis2 client resulting in javax.xml.stream.XMLStreamException
> ----------------------------------------------------------------------------------------------
>
>          Key: AXIS2-247
>          URL: http://issues.apache.org/jira/browse/AXIS2-247
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug
>     Versions: 0.91, 0.92
>  Environment: Windows XP, using java and .Net and WSE 2.0
>     Reporter: KumudaBhaskar

>
> I was trying to call the .Net webservice from Axis2 client. I am using axis2-0.92 the
latest....
> I am getting the following Exception
> org.apache.axis2.AxisFault: null; nested exception is: 
>       javax.xml.stream.XMLStreamException
>       at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:97)
>       at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:47)
>       at org.apache.axis2.clientapi.TwoWayTransportBasedSender.send(TwoWayTransportBasedSender.java:53)
>       at org.apache.axis2.clientapi.InOutMEPClient.invokeBlocking(InOutMEPClient.java:177)
>       at com.hyperion.tcp.TCPClient.main(TCPClient.java:46)
> Caused by: javax.xml.stream.XMLStreamException
>       at com.bea.xml.stream.MXParser.checkForXMLDecl(MXParser.java:712)
>       at com.bea.xml.stream.MXParser.setInput(MXParser.java:721)
>       at com.bea.xml.stream.MXParserFactory.createXMLStreamReader(MXParserFactory.java:235)
>       at com.bea.xml.stream.MXParserFactory.createXMLStreamReader(MXParserFactory.java:64)
>       at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:89)
>       ... 4 more
> Exception in thread "main"
>  
> From port peeker, I found that the xml that is being created by Axis2 client is
>  
> <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"><soapenv:Header><wsa:Action>http://stockservice.contoso.com/wse/samples/2003/06/Concat</wsa:Action><wsa:MessageID>uuid:b6272374-e72a-464d-8af2-76199b15aea1</wsa:MessageID><wsa:ReplyTo><wsa:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address></wsa:ReplyTo><wsa:To>soap://stockservice.contoso.com/wse/samples/2003/06/TcpSyncStockService</wsa:To></soapenv:Header><soapenv:Body><v:Concat
xmlns:v="http://stockservice.contoso.com/wse/samples/2003/06/Concat"><v:FirstStr>Hello
</v:FirstStr><v:SecondStr> World</v:SecondStr></v:Concat></soapenv:Body></soapenv:Envelope>
>  
> Axis2 client souce code is as follows
> /*
>  * Copyright 2004,2005 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 com.hyperion.hfm.acistcptest;
>  
> import org.apache.axis2.AxisFault;
> import org.apache.axis2.Constants;
> import org.apache.axis2.addressing.EndpointReference;
> import org.apache.axis2.clientapi.Call;
> import org.apache.axis2.context.ConfigurationContext;
> import org.apache.axis2.context.ConfigurationContextFactory;
> import org.apache.axis2.context.MessageContext;
> import org.apache.axis2.context.ServiceContext;
> import org.apache.axis2.description.OperationDescription;
> import org.apache.axis2.description.ServiceDescription;
> import org.apache.axis2.description.TransportOutDescription;
> import org.apache.axis2.soap.SOAPEnvelope;
> import org.apache.axis2.soap.SOAPFactory;
> import org.apache.axis2.transport.TransportSender;
> import org.apache.axis2.transport.tcp.TCPTransportSender;
> import org.apache.axis2.engine.AxisConfigurationImpl;
> import org.apache.axis2.addressing.om.AddressingHeaders;
> import org.apache.axis2.om.OMAbstractFactory;
> import org.apache.axis2.om.OMDocument;
> import org.apache.axis2.om.OMElement;
> import org.apache.axis2.om.OMFactory;
> import org.apache.axis2.om.OMNamespace;
> import org.apache.axis2.addressing.om.*;
> import javax.xml.namespace.QName;
> import org.apache.axis2.clientapi.MessageSender;
>  
> import javax.xml.stream.FactoryConfigurationError;
> import javax.xml.stream.XMLOutputFactory;
> import javax.xml.stream.XMLStreamException;
> import javax.xml.stream.XMLStreamWriter;
>  
> /**
>  * This is a Client progam that accesses 'MyService' web service in Axis2 samples
>  */
> public class AxisClient {
>  
>     private static String toEpr = "soap.tcp://blrl2790:2342/StockService";
>  
>     public static void main(String[] args) throws AxisFault {
>  
>             EndpointReference wsaTo = new EndpointReference("soap://stockservice.contoso.com/wse/samples/2003/06/TcpSyncStockService");
>             AddressingHeaders headers = new AddressingHeaders(wsaTo, "http://stockservice.contoso.com/wse/samples/2003/06/StockQuoteRequest");
>             
>             
>             MessageContext requestContext = null; 
>                         //FaxReceive.request(new TFaxReceive(account, password));
>  
>         QName opName = new QName("soap://stockservice.contoso.com/wse/samples/2003/06/TcpSyncStockService",
"GetStockQuotes");
>  
>         OperationDescription opdesc = new OperationDescription(opName);
>             
>             EndpointReference targetEPR = new EndpointReference(toEpr);
>             org.apache.axis2.clientapi.Call call = new org.apache.axis2.clientapi.Call();
>             call.setTo(targetEPR);
>     
>             call.engageModule(new QName(Constants.MODULE_ADDRESSING));
>     
>             call.setWsaAction("http://stockservice.contoso.com/wse/samples/2003/06/StockQuoteRequest");
>             
>             call.setTransportInfo(Constants.TRANSPORT_TCP, Constants.TRANSPORT_TCP, false);
>  
>             ConfigurationContextFactory fac = new ConfigurationContextFactory();
>  
>         ConfigurationContext configContext = fac.buildClientConfigurationContext("StockQuoteRequest");
>  
>         try {
>  
>             requestContext = new MessageContext(configContext);
>  
>         } catch (AxisFault axisFault) {
>  
>             axisFault.printStackTrace();
>  
>         }
>         SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
>         OMNamespace ns1 = factory.createOMNamespace("http://stockservice.contoso.com/wse/samples/2003/06","NS1");
>  
>         SOAPEnvelope envelope = factory.getDefaultEnvelope();
>         OMElement operation = factory.createOMElement("StockQuoteRequest",ns1);
>         envelope.getBody().addChild(operation);
>         OMElement first = factory.createOMElement("symbols", ns1);
>         //OMElement second = fac.createOMElement("Symbol");
>         OMElement value = factory.createOMElement("Symbol", ns1);
>         value.addChild(factory.createText(value, "FABRIKAM"));
>         first.addChild(value);
>         operation.addChild(first);
>         requestContext.setEnvelope(envelope);
>             
>             call.invokeBlocking(opdesc, requestContext);
>             //OMElement result =
>               //      (OMElement) call.invokeBlocking("GetStockQuotes", getPayload());
>             //call.close();
>  
>     
>             /*OMFactory fac = OMAbstractFactory.getOMFactory();
>             String tryThisNamespace = "http://stockservice.contoso.com/wse/samples/2003/06/tryThis";
>         OMNamespace omNs = fac.createOMNamespace(tryThisNamespace, "xmlns");
>         OMElement method = fac.createOMElement("tryThis", omNs);
>         OMElement value = fac.createOMElement("Text", omNs);
>         value.addChild(fac.createText(value, "Axis2 Ping String "));
>         method.addChild(value);
>         MessageSender msgSender = new MessageSender();
>         msgSender.setTo(targetEPR);
>         msgSender.setSenderTransport(Constants.TRANSPORT_TCP);
>         msgSender.engageModule(new QName(Constants.MODULE_ADDRESSING));
>         
>         msgSender.setWsaAction(tryThisNamespace);
>     
>         msgSender.send("tryThis", method);
> */
>         
>             /*TCPTransportSender sender = new TCPTransportSender();
>         sender.startSendWithToAddress(new MessageContext(), new OutputStream)
>         
>         sender.finalizeSendWithToAddress(new MessageContext(), )
>             Call call = new Call();
>         call.setTo(new EndpointReference(toEpr));
>         call.setTransportInfo(Constants.TRANSPORT_TCP,
>                 Constants.TRANSPORT_TCP,
>                 false);*/
>         //call.engageModule(new QName(Constants.MODULE_ADDRESSING));
>         
>         
>         
>  
>         
>         
>        /*OMElement result = call.invokeBlocking("echo", getPayload());
>         //OMElement result = call.i("echo", getPayload());
>         
>         try {
>             XMLStreamWriter writer = XMLOutputFactory.newInstance()
>                     .createXMLStreamWriter(System.out);
>             result.serializeWithCache(writer);
>             writer.flush();
>         } catch (XMLStreamException e) {
>             e.printStackTrace();
>         } catch (FactoryConfigurationError e) {
>             e.printStackTrace();
>         }*/
>     }
>  
>  
>     private static OMElement getPayload() {
>         OMFactory fac = OMAbstractFactory.getOMFactory();
>         OMDocument doc = fac.createOMDocument();
>         String tryThisNamespace = "http://stockservice.contoso.com/wse/samples/2003/06/tryThis";
>         OMNamespace omNs = fac.createOMNamespace(
>                         "http://stockservice.contoso.com/wse/samples/2003/06", "StockQuoteRequest");
>         //OMNamespace omNs = fac.createOMNamespace(tryThisNamespace, "v");
>         //OMElement method = fac.createOMElement("tryThis", omNs);
>         OMElement method = fac.createOMElement("StockQuoteRequest", omNs);
>         OMElement first = fac.createOMElement("symbols", omNs);
>         //OMElement second = fac.createOMElement("Symbol");
>         OMElement value = fac.createOMElement("Symbol", omNs);
>         value.addChild(fac.createText(value, "FABRIKAM"));
>         first.addChild(value);
>         method.addChild(first);
>         //doc.setDocumentElement(method);
>         //return  doc.getDocumentElement();
>         return method;
>     }
>  }
> for which I got reply from deepal as below :
> You have got that problem due to your Inputstream is null and you re trying to create
SOAPMessage out of that , and the problem is not in your code it in Axis2 side . We have found
the problem it is due to transport receivers problem we will fix that soon , if you can please
create a JIRA issue too.
> I hope the issue will be resolved soon and we will be able to use Axis2 in our project
> Thanks and Regards
> KumudaRajarshi

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message