WebService course

xiaoxiao2021-03-06  56

First, WebService:

Call a given location WebService's client code:

1 import org.apache.axis.client.call;

2 import org.apache.axis.client.service;

3 Import javax.xml.namespace.qname;

4

5 public class testclient {

6 public static void main (string [] args) {

7 try {

8 string endpoint =

9 "http://nagoya.apache.org:5049/AXIS/Services/echo";

10

11 Service Service = New Service ();

12 call call = (call) service.createcall ();

13

14 Call.SettargetendPointd ADRESS (New Java.Net.URL (Endpoint));

15 Call.SetoperationName (New Qname ("http://soapinterop.org/", "echostring");

16

17 string ret = (string) Call.invoke (new object [] {"Hello!"});

18

19 System.out.println ("Sent 'Hello!', GOT '" RET "'");

20} catch (exception e) {

21 System.err.Println (E.TOString ());

twenty two }

twenty three }

twenty four }

SOAP REQUEST content:

XMLns: soap-env = "http://schemas.xmlsoap.org/soap/envelop/"

XMLns: xsi = "http://www.w3.org/2001/xmlschema-instance">

Hello!

Release WebService:

1, JWS file

2, deploy the Application Server to the Application Server class through the Adminoclient class

Second, AXIS TOMCAT

1. Prepare the AXIS configuration for testing WebService:

Complete WSDL from the Java class file, the corresponding command is as follows:

Java -classpath.;% AXISCLASSPATH%; org.apache.axis.wsdl.java2wsdl -o testservice.wsdl -l "http://172.16.87.18:8000/AXIS/Services/ testservice" -n "http: //172.16 .87.18: 8000 / axis / services / testservice "-p" com.zzxy.test. TestService "" http://172.16.87.18:8000/axis/services/testservice "com.zzxy.test. TestService) Generate WSDL files Run WSDL2JAVA Generate new interfaces, service, servicelocate, stub, skeleton, etc., including deployment (uninstall) file deploy.wsdd undeploy.wsdd. The corresponding command is as follows:

Java-ClassPath.;% AXISCLASSPATH% org.apache.axis.wsdl.wsdl2java -o ../src -d session -s -s true -n http://172.16.87.18:8000/AXIS/Services/service COM. ZZXy.TestService TestService.wsdl

Compile the generated Java file:

deploy:

Java -cp% AXISCLASSPATH% org.apache.axis.client.adminClient -LHttp: // 172.16.87.18:8000/AXIS/Services/adminservice deploy.wsdd

Ant example of dynamic report

Namespace = "$ {targetnamespace}" classname = "com.xinyuan.dtbb.xybb">

Deployscope = "session">

servletPath = "/ axis / servlet / axisservlet" debug = "true" xmlfile = "$ {local.wsdl}" />

Second, OC4J

You need to use the OC4J-specific function to configure according to certain requirements.

Deploy EJB to WebService profile

Session Bean as a web service

.

.

./ ws-xybb.ear

./ TMP

/ ws-xybb_web

/ XYBBWS

./ xybbservice.jar

XYBBService

Deployed ANT script:

Third, JBoss

JBoss-net.sar is required, in the configuration of the ALL, the standard AXIS deployment error.

转载请注明原文地址:https://www.9cbs.com/read-111819.html

New Post(0)