Hi Davanum !! :
Many thanks for your help and time.
I've logged a new issue in your jira bug tracker with the service
and client code, and the Exception generated by running the client.
The issue id is : AXIS2-2960
Could you tell me if there is a bug in Axis 2 or if i've done
something wrong?.
2007/7/13, Davanum Srinivas <[EMAIL PROTECTED]>:
Albert,
Please log a issue in our jira bug tracker with your service and client code.
thanks,
dims
On 7/13/07, albert quinn <[EMAIL PROTECTED]> wrote:
> Hi !! :
>
> I'm a newbie in the Axis wolrd, I've been reading all the Axis 2
> docs and then, I've started to try this and that to discover how could
> i do what i need the easiest way.
>
> I need to do a web service receiving a file in a
> javax.activation.DataHandler and saving it to the file system and
> another web service returning a file from the file system in a
> javax.activation.DataHandler.
>
> So I've tried to do that in the easiest way. I've created this web
> service class :
>
> package code.prueba;
>
> import ....
>
> public class PruebaBD {
>
> public DataHandler getFile() {
>
> DataHandler oDataHandler = new DataHandler( new FileDataSource(
> "C:\\prueba\\file.txt" ) );
>
> return oDataHandler;
> }
>
> }
>
> Then I've used the Eclipse plugin "Axis 2 Service Archiver" to
> generate the ".aar" file and I've deployed the web service in Axis 2.
> I can see the service up and runnning in :
> http://localhost:8080/axis2/services/listServices
>
> So, I've used the "POJO Web Services using Apache Axis2" tutorial to
> create a client for the deployed web service using the
> RPCServiceClient. This is my client :
>
>
> package code.prueba;
>
> import ....
>
> public class RPClient {
> public static void main(String[] args) {
> try {
>
> RPCServiceClient serviceClient = new RPCServiceClient();
> Options options = serviceClient.getOptions();
> EndpointReference target = new EndpointReference
> "http://localhost:8080/axis2/services/PruebaBD/getFile");
> options.setTo(target);
> QName op = new QName("http://prueba.code/xsd", "getFile");
> Object[] opArgs= new Object[] { };
> Class[] returnTypes = new Class[] { DataHandler.class };
>
> Object[] response = serviceClient.invokeBlocking(op, opArgs,
returnTypes);
>
> DataHandler dh = (DataHandler) response[0];
>
> if (dh == null)
> System.out.println("ERROR !!! dh == NULL");
> else {
> System.out.println("file name : " + dh.getName() );
> FileOutputStream fos = new FileOutputStream( "C:\\prueba\\file.txt"
);
> dh.writeTo(fos);
> fos.close();
> }
> } catch (AxisFault fault) {
> System.out.println("ERROR !!!!! Fault.");
> fault.printStackTrace();
> } catch(Exception oException) {
> System.out.println("ERROR !!!!! Exception.");
> oException.printStackTrace();
> }
> }
> }
>
> When I've runned my RPClient, I've got that Exception :
>
>
> ERROR !!!!! Exception.
> org.apache.axiom.soap.SOAPProcessingException:
> com.ctc.wstx.exc.WstxEOFException: Unexpected EOF; was expecting a
> close tag for element <faultstring>
> at [row,col {unknown-source}]: [1,193]
> at
org.apache.axiom.soap.impl.builder.SOAP11BuilderHelper.processText(SOAP11BuilderHelper.java:156)
> at
org.apache.axiom.soap.impl.builder.SOAP11BuilderHelper.handleEvent(SOAP11BuilderHelper.java:73)
> at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:345)
> at
org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:182)
> at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:135)
> at
org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:546)
> at
org.apache.axiom.om.impl.llom.OMNodeImpl.getNextOMSibling(OMNodeImpl.java:131)
> at
org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementImpl.java:268)
> at
org.apache.axiom.om.impl.traverse.OMChildrenQNameIterator.next(OMChildrenQNameIterator.java:90)
> at
org.apache.axiom.om.impl.llom.OMElementImpl.getFirstChildWithName(OMElementImpl.java:221)
> at
org.apache.axiom.soap.impl.llom.soap11.SOAP11FaultImpl.getCode(SOAP11FaultImpl.java:132)
> at org.apache.axis2.AxisFault.initializeValues(AxisFault.java:173)
> at org.apache.axis2.AxisFault.<init>(AxisFault.java:167)
> at
org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:434)
> at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:373)
> at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
> at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:520)
> at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:500)
> at
org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:97)
> at borrar.main(borrar.java:24)
> Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF; was
> expecting a close tag for element <faultstring>
> at [row,col {unknown-source}]: [1,193]
> at
com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:661)
> at
com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2730)
> at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1019)
> at
org.apache.axiom.soap.impl.builder.SOAP11BuilderHelper.processText(SOAP11BuilderHelper.java:143)
> ... 19 more
>
>
> So, my question is : am I doing something wrong? is not possible to
> do a POJO service returning a file in a DataHandler? If it's possible
> to do a POJO service that way, is it possible to do a RPC client that
> way? If not, what kind of client should I do?
>
> Many thanks to any Axis 2 guru who give me any ideas about what to
> do to get up and running the Web Service I need to do.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Davanum Srinivas :: http://davanum.wordpress.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]