Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a Axis webservice? 1

Status
Not open for further replies.

jollyplay

Programmer
Dec 16, 2003
90
Hi,

I want to create an Axis webservice using servlet. I'm able to write the client code but I'm struggling in writting the server code (to handle SOAP request in the server code).

I wrote a java class and rename it as .jws file extension it's working fine. But I need to write a servlet for the server.

Its very urgent. Please kindly give me some suggestions.

Thanks in advance.
 
Whenever I have worked with Axis on the server side, all I did was write a handler class, ie like this :

Code:
package com.acme;
public class ServiceHandler {

  public String someMethodAClientCanCall(String param1) {
     return "Hello World !";
  }
}

Then I deployed this code in a webapp, with a file called server-config.wsdd :

Code:
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="[URL unfurl="true"]http://xml.apache.org/axis/wsdd/"[/URL] xmlns:java="[URL unfurl="true"]http://xml.apache.org/axis/wsdd/providers/java">[/URL]
 <globalConfiguration>
  <parameter name="sendXsiTypes" value="true"/>
  <parameter name="sendMultiRefs" value="true"/>
  <parameter name="sendXMLDeclaration" value="true"/>
  <parameter name="axis.sendMinimizedElements" value="true"/>
 </globalConfiguration>
 <handler name="LocalResponder" type="java:org.apache.axis.transport.local.LocalResponder"/>
 <handler name="URLMapper" type="java:org.apache.axis.handlers.http.URLMapper"/>
 <handler name="Authenticate" type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/>


 <service name="main" provider="java:RPC">
  <parameter name="allowedMethods" value="someMethodAClientCanCall"/>
  <parameter name="wsdlServicePort" value="someMethodAClientCanCall"/>
  <parameter name="className" value="com.acme.ServiceHandler"/>
 </service>


 <transport name="http">
  <requestFlow>
   <handler type="URLMapper"/>
   <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
  </requestFlow>
 </transport>
 <transport name="local">
  <responseFlow>
   <handler type="LocalResponder"/>
  </responseFlow>
 </transport>
</deployment>

Then axis will create a WSDL from your handler class, and your web services/soap service will be created.

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Thanks sedj.

I need to send the requestor IPAddress with the SOAP response. Kindly give me some suggestions.

Thanks in advance.
 
I have no idea ...
Why do you need to send the IP address of the client back to the client (surely the client knows its own IP) ?

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top