简体   繁体   中英

How to use javax.xml.ws without interface of soap webService

I want to use a SOAP webservice with below URL:

http://ws.armaghan.net:8080/ws-relay/MessageRelayService?wsdl

According to post at How to do a call through a javax.xml.ws.Service I developed below code:

URL url= new URL("http://ws.armaghan.net:8080/ws-relay/MessageRelayService?wsdl");


QName qname= new QName("http://webservice.smsrelay.armaghan.net/","MessageRelayService");


Service service = Service.create(url, qname);

but at next step I do not now how to use service.getPort(Claas arg0) because I have not the interface of my SOAP web service. The only thing I have is the above URL.

By the way my question is that how can I use the web-service?

Thanks,

First you need to generate the client for the Web service through WSIMPORT or similar tool.

after that the generated client artifacts should be integrated with your client side code to call web service operations. you can refer following blog post that has the clear steps one by one.

http://chathurangat.blogspot.com/2013/09/how-to-generate-jax-ws-client-and.html

You should use a tool for generating the interfaces and the client. I usually save the wsdl file to my java project and use the ide to generate source code from the wsdl file.

Then you can choose your preferred framework. Axis, cxf, ws or what you want.

You can also use commandline tools like for example this

http://www.mkyong.com/webservices/jax-ws/jax-ws-wsimport-tool-example/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM