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 ni...@wipro.com on 2004/06/15 12:12:14 UTC
facing XML parser exception while using Axis
Hi,
We are using Axis to connect to the MapPoint service from Microsoft. My application is throwing an XMLparser exception. I have attached the log below. Does anyone have anyidea on this.
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXParseException: Premature end of file.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace: org.xml.sax.SAXParseException:
Premature end of file.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContextImpl.parse(Deserializa
tionContextImpl.java:242)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
at org.apache.axis.client.Call.invoke(Call.java:2553)
at org.apache.axis.client.Call.invoke(Call.java:2248)
at org.apache.axis.client.Call.invoke(Call.java:2171)
at org.apache.axis.client.Call.invoke(Call.java:1691)
at net.mappoint.s.mappoint_30.FindServiceSoapStub.findAddress(FindServic
eSoapStub.java:1110)
Thanks & Regards,
Nishit
-----Original Message-----
From: Dorner Thomas [mailto:thomas.dorner@edmb.debis.com]
Sent: Tue 6/15/2004 3:06 PM
To: 'axis-user@ws.apache.org'
Cc:
Subject: AW: How to get the SOAP Envelope from msg Context without invocation
Hi,
I am working on WS-security Handlers to sign and encrypt my SOAP.
I am interessted, if someone of you use the XML-Security API from Apache instead of
the TSIK from Verisign?
If someone have me some Code-Snippet for the encrypt and decrypt Method, it would be welcome :)
Thanks Tomi
-----Ursprüngliche Nachricht-----
Von: GANDHIRAJAN, AYYAPPAN [mailto:ayyappan.gandhirajan@hp.com]
Gesendet: Dienstag, 15. Juni 2004 11:29
An: axis-user@ws.apache.org
Betreff: RE: How to get the SOAP Envelope from msg Context without invocation
Hi jose,
I dont know if it is helpful to you.
I adapted a different approach in this case. I created soap envelope first, signed it and used call.invoke(envelope) api. This worked for me. if you are interested, I can give the code snippet for you.
Thanks & regards,
Ayyappan Gandhirajan
-----------------------------------------------------------------
Hewlett-Packard Global Delivery India Center
Office: (+91) 80.2205.1472
Mobile: (+91) 94483.14969
Mail: ayyappan.gandhirajan@hp.com
-----------------------------------------------------------------
-----Original Message-----
From: Dhanush Gopinath [mailto:dhanush@mahindrabt.com]
Sent: Monday, June 07, 2004 10:07 AM
To: axis-user@ws.apache.org
Subject: Re: How to get the SOAP Envelope from msg Context without invocation
Jose,
Handlers are called while request and response flows. It is an automatic process...
I dont know much more than this as I am also in the learning phase :) Hope some one can help
Dhanush
----- Original Message -----
From: Jose M. Selman <ma...@bee.cl>
To: axis-user@ws.apache.org
Sent: Friday, June 04, 2004 7:47 PM
Subject: Re: How to get the SOAP Envelope from msg Context without invocation
Is it possible to programatically set client-side handlers? That way my problem would be solved.
Cheers,
Jose M. Selman
----- Original Message -----
From: Dhanush Gopinath <ma...@mahindrabt.com>
To: axis-user@ws.apache.org
Sent: Thursday, June 03, 2004 11:50 PM
Subject: Re: How to get the SOAP Envelope from msg Context without invocation
Jose,
You wont be able to get a SOAPEnvelope at the client end after the call or before the call .. because before the call there is no SOAPMessage and after the Call the response is over.
and Call.getMessgaeContext() will return a null value. So you cant access that Message Context.
How ever you can do one thing.
You can implement a Handler which will be invoked only in the requestFlow and can then manipulate the SOAPMessage and the Handler end.
To do that you must add a handler in the deploy.wsdd file and write a Handler class which extends the BasicHandler class of Axis APIs.
<handler name="AttachmentHandler" type="java:com.bt.oexgateway.webservices.AttachmentHandler"/>
<service name="TestOAGXMLService" provider="java:RPC" style="rpc" use="encoded">
<requestFlow>
<handler type="AttachmentHandler"/>
</requestFlow>
<responseFlow>
<handler type="AttachmentHandler"/>
</responseFlow>
....
</service>
The handler class will be something like this
import org.apache.axis.handlers.BasicHandler;
public class AttachmentHandler extends BasicHandler
{
public void invoke(MessageContext msgContext) throws AxisFault
{
System.out.println("Hi Hi Handler Invoked !! ");
// Gets the Request SOAP Message
Message reqMsg = msgContext.getRequestMessage();
// Gets the response SOAP Message
Message respMsg = msgContext.getResponseMessage();
...
....
}
}
During the call from the client the method invoke() of the declared handler is called . It depends on the declaration in the WSDD file . If you need it in both requestFlow and responseFlow then give as above wsdd. if you need only in request then only <requestFlow> is needed.. Depends upon you and ur application.
People, Hope I am right here.
Hope this helps you
Cheers
Dhanush
----- Original Message -----
From: Jose M. Selman <ma...@bee.cl>
To: axis-user@ws.apache.org
Sent: Friday, June 04, 2004 8:00 AM
Subject: How to get the SOAP Envelope from msg Context without invocation
Hi:
I'm writing an Axis Client that needs to send RPC style signed requests
according to XML-DSIG. My problem is that in order to sign the SOAP Envelope
I need to first have it! :-) I have looked everywhere but I haven't found
where to do this.
I'm doing
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endPoint) );
call.setOperationName( new QName(endPoint, operationName) );
call.addParameter( "String", XMLType.XSD_STRING, ParameterMode.IN );
call.setReturnType( XMLType.XSD_STRING );
String resu = (String) call.invoke(new Object[] { "Some String Input" });
After this last statement I can get the SOAP Message from the message
context doing:
mc = call.getMessageContext();
env = request.getSOAPEnvelope();
But the service was already invoked!!!Is there any way of setting the
parameters used for a call without actually invoking the service?
Cheers,
Jose M Selman
*********************************************************
Disclaimer:
This message (including any attachments) contains
confidential information intended for a specific
individual and purpose, and is protected by law.
If you are not the intended recipient, you should
delete this message and are hereby notified that
any disclosure, copying, or distribution of this
message, or the taking of any action based on it,
is strictly prohibited.
*********************************************************
Visit us at http://www.mahindrabt.com
*********************************************************
Disclaimer:
This message (including any attachments) contains
confidential information intended for a specific
individual and purpose, and is protected by law.
If you are not the intended recipient, you should
delete this message and are hereby notified that
any disclosure, copying, or distribution of this
message, or the taking of any action based on it,
is strictly prohibited.
*********************************************************
Visit us at http://www.mahindrabt.com
Re: facing XML parser exception while using Axis
Posted by Davanum Srinivas <da...@gmail.com>.
http://demo.mappoint.net/
On Tue, 15 Jun 2004 15:42:14 +0530, nishit.kumar@wipro.com
<ni...@wipro.com> wrote:
>
> Hi,
>
> We are using Axis to connect to the MapPoint service from Microsoft. My application is throwing an XMLparser exception. I have attached the log below. Does anyone have anyidea on this.
>
> AxisFault
> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> faultSubcode:
> faultString: org.xml.sax.SAXParseException: Premature end of file.
> faultActor:
> faultNode:
> faultDetail:
> {http://xml.apache.org/axis/}stackTrace: org.xml.sax.SAXParseException:
> Premature end of file.
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at javax.xml.parsers.SAXParser.parse(Unknown Source)
> at org.apache.axis.encoding.DeserializationContextImpl.parse(Deserializa
> tionContextImpl.java:242)
> at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
> at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
> at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
> at org.apache.axis.client.Call.invoke(Call.java:2553)
> at org.apache.axis.client.Call.invoke(Call.java:2248)
> at org.apache.axis.client.Call.invoke(Call.java:2171)
> at org.apache.axis.client.Call.invoke(Call.java:1691)
> at net.mappoint.s.mappoint_30.FindServiceSoapStub.findAddress(FindServic
> eSoapStub.java:1110)
>
> Thanks & Regards,
> Nishit
>
> -----Original Message-----
> From: Dorner Thomas [mailto:thomas.dorner@edmb.debis.com]
> Sent: Tue 6/15/2004 3:06 PM
> To: 'axis-user@ws.apache.org'
> Cc:
> Subject: AW: How to get the SOAP Envelope from msg Context without invocation
>
> Hi,
>
> I am working on WS-security Handlers to sign and encrypt my SOAP.
> I am interessted, if someone of you use the XML-Security API from Apache instead of
> the TSIK from Verisign?
>
> If someone have me some Code-Snippet for the encrypt and decrypt Method, it would be welcome :)
>
> Thanks Tomi
>
> -----Ursprüngliche Nachricht-----
> Von: GANDHIRAJAN, AYYAPPAN [mailto:ayyappan.gandhirajan@hp.com]
> Gesendet: Dienstag, 15. Juni 2004 11:29
> An: axis-user@ws.apache.org
> Betreff: RE: How to get the SOAP Envelope from msg Context without invocation
>
> Hi jose,
>
> I dont know if it is helpful to you.
>
> I adapted a different approach in this case. I created soap envelope first, signed it and used call.invoke(envelope) api. This worked for me. if you are interested, I can give the code snippet for you.
>
> Thanks & regards,
> Ayyappan Gandhirajan
> -----------------------------------------------------------------
> Hewlett-Packard Global Delivery India Center
> Office: (+91) 80.2205.1472
> Mobile: (+91) 94483.14969
> Mail: ayyappan.gandhirajan@hp.com
> -----------------------------------------------------------------
>
> -----Original Message-----
> From: Dhanush Gopinath [mailto:dhanush@mahindrabt.com]
> Sent: Monday, June 07, 2004 10:07 AM
> To: axis-user@ws.apache.org
> Subject: Re: How to get the SOAP Envelope from msg Context without invocation
>
> Jose,
>
> Handlers are called while request and response flows. It is an automatic process...
> I dont know much more than this as I am also in the learning phase :) Hope some one can help
>
> Dhanush
>
> ----- Original Message -----
> From: Jose M. Selman <ma...@bee.cl>
> To: axis-user@ws.apache.org
> Sent: Friday, June 04, 2004 7:47 PM
> Subject: Re: How to get the SOAP Envelope from msg Context without invocation
>
> Is it possible to programatically set client-side handlers? That way my problem would be solved.
>
> Cheers,
>
> Jose M. Selman
>
> ----- Original Message -----
> From: Dhanush Gopinath <ma...@mahindrabt.com>
> To: axis-user@ws.apache.org
> Sent: Thursday, June 03, 2004 11:50 PM
> Subject: Re: How to get the SOAP Envelope from msg Context without invocation
>
> Jose,
>
> You wont be able to get a SOAPEnvelope at the client end after the call or before the call .. because before the call there is no SOAPMessage and after the Call the response is over.
>
> and Call.getMessgaeContext() will return a null value. So you cant access that Message Context.
>
> How ever you can do one thing.
>
> You can implement a Handler which will be invoked only in the requestFlow and can then manipulate the SOAPMessage and the Handler end.
>
> To do that you must add a handler in the deploy.wsdd file and write a Handler class which extends the BasicHandler class of Axis APIs.
>
> <handler name="AttachmentHandler" type="java:com.bt.oexgateway.webservices.AttachmentHandler"/>
>
> <service name="TestOAGXMLService" provider="java:RPC" style="rpc" use="encoded">
> <requestFlow>
> <handler type="AttachmentHandler"/>
> </requestFlow>
> <responseFlow>
> <handler type="AttachmentHandler"/>
> </responseFlow>
> ....
> </service>
>
> The handler class will be something like this
>
> import org.apache.axis.handlers.BasicHandler;
>
> public class AttachmentHandler extends BasicHandler
> {
> public void invoke(MessageContext msgContext) throws AxisFault
> {
> System.out.println("Hi Hi Handler Invoked !! ");
>
> // Gets the Request SOAP Message
> Message reqMsg = msgContext.getRequestMessage();
> // Gets the response SOAP Message
> Message respMsg = msgContext.getResponseMessage();
>
> ...
> ....
> }
> }
>
> During the call from the client the method invoke() of the declared handler is called . It depends on the declaration in the WSDD file . If you need it in both requestFlow and responseFlow then give as above wsdd. if you need only in request then only <requestFlow> is needed.. Depends upon you and ur application.
>
> People, Hope I am right here.
> Hope this helps you
>
> Cheers
> Dhanush
>
> ----- Original Message -----
> From: Jose M. Selman <ma...@bee.cl>
> To: axis-user@ws.apache.org
> Sent: Friday, June 04, 2004 8:00 AM
> Subject: How to get the SOAP Envelope from msg Context without invocation
>
> Hi:
> I'm writing an Axis Client that needs to send RPC style signed requests
> according to XML-DSIG. My problem is that in order to sign the SOAP Envelope
> I need to first have it! :-) I have looked everywhere but I haven't found
> where to do this.
>
> I'm doing
>
> Service service = new Service();
> Call call = (Call) service.createCall();
> call.setTargetEndpointAddress( new java.net.URL(endPoint) );
> call.setOperationName( new QName(endPoint, operationName) );
> call.addParameter( "String", XMLType.XSD_STRING, ParameterMode.IN );
> call.setReturnType( XMLType.XSD_STRING );
> String resu = (String) call.invoke(new Object[] { "Some String Input" });
>
> After this last statement I can get the SOAP Message from the message
> context doing:
>
> mc = call.getMessageContext();
> env = request.getSOAPEnvelope();
>
> But the service was already invoked!!!Is there any way of setting the
> parameters used for a call without actually invoking the service?
>
> Cheers,
>
> Jose M Selman
>
> *********************************************************
> Disclaimer:
>
> This message (including any attachments) contains
>
> confidential information intended for a specific
>
> individual and purpose, and is protected by law.
>
> If you are not the intended recipient, you should
>
> delete this message and are hereby notified that
>
> any disclosure, copying, or distribution of this
> message, or the taking of any action based on it,
>
> is strictly prohibited.
>
> *********************************************************
> Visit us at http://www.mahindrabt.com
>
> *********************************************************
> Disclaimer:
>
> This message (including any attachments) contains
>
> confidential information intended for a specific
>
> individual and purpose, and is protected by law.
>
> If you are not the intended recipient, you should
>
> delete this message and are hereby notified that
>
> any disclosure, copying, or distribution of this
> message, or the taking of any action based on it,
>
> is strictly prohibited.
>
> *********************************************************
> Visit us at http://www.mahindrabt.com
>
>
>
>
> winmail.dat - 1K
>
--
Davanum Srinivas - http://webservices.apache.org/~dims/