I think that you end point URL is incorrect, it should be http://localhost:8080/axis/delta. Usually, and in code examples, URL is like http://localhost:8080/axis/services/....
Another problem : you should put your .class files in the WEB-INF/classes directory of your web app (ie delta)


Paul Phillips wrote:

Hello,

I am trying to setup an Axis web service the "proper" way, by not using the .jws technique, but I am having a few difficulties.

On the server side I have several classes that have to import each other, specifically one that returns a connection to my database. Now I know these classes work on their own, I can connect to the database by running it as a standalone app. However, deploying and calling it from the client is puzzling me.

I have my service setup at http://localhost:8080/axis/delta and I have created a package org.ppinc.deltadown. So I now have a path http://localhost:8080/axis/delta/org/ppinc/deltadown/ where my .java and .class files are.

Now I don't know what I am supposed to do, am I supposed to create a .jar file of this packages directory structure? If I am, where do I put the .jar? Where am I supposed to point the client app?

I have created a deploy.wsdd that looks like this:

<deployment xmlns="http://xml.apache.org/axis/wsdd/"; xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>
<service name="deltadown" provider="java:RPC">
<parameter name="className" value="org.ppinc.deltadown.ProcessLogin"/>
<parameter name="allowedMethods" value="*"/>
<operation name="authenticateUser">
<parameter name="arg1" mode="IN"/>
</operation>
</service>
</deployment>


So I have a class called ProcessLogin with one function called authenticateUser that takes one parameter.

I have deployed the service by running

java -cp $AXISCLASSPATH org.apache.axis.client.AdminClient -lhttp://localhost:8080/axis/services/AdminService deploy.wsdd
Processing file deploy.wsdd
<Admin>Done processing</Admin>


On the client side I have this code:

String endpointURL = "http://127.0.0.1:8081/axis/delta/org/ppinc/deltadown/";;

Service  service = new Service();
Call call = (Call)service.createCall();

call.setTargetEndpointAddress(new java.net.URL(endpointURL));
call.setOperationName(new QName("MyService", "authenticateUser"));
call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
String ret = (String) call.invoke( new Object[] { "a string" } );

And when I run this the service just returns a html page that you get if you browsed to http://127.0.0.1:8081/axis/delta/org/ppinc/deltadown/

The stack trace looks like this:

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: Bad envelope tag: html
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace: org.xml.sax.SAXException: Bad envelope tag: html
at org.apache.axis.message.EnvelopeBuilder.startElement(EnvelopeBuilder.java:109)


at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:976)

at org.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:454)

at org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(XMLNamespaceBinder.java:876)

at org.apache.xerces.impl.XMLNamespaceBinder.startElement(XMLNamespaceBinder.java:568)

at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:756)

at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:752)

at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(XMLDocumentScannerImpl.java:942)

at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1520)

at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)

at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:524)

at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:580)

at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1169)


at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.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 Login.doLogin(Login.java:58)

Is my endpointURL setup correctly?
What am I supposed to do with the package I have created on the server? (ie, create a .jar etc)
Is this the right code to be calling from the client?



Any help will be much appreciated


~Paul P




Reply via email to