12 Ocak 2014 Pazar

JDK wsimport ile Jaxws webservis client'i ile webservis çağırma

Merhabalar,

wsimport ile ürettiğiniz webservis client'larından aşağıdaki şekilde request yapabilirsiniz.

MyService_Service service = new MyService_Service(
this.getClass()
.getResource(
"/com/abc/webservices/wsdls/Mywsdl.wsdl"),
new QName("http://mobile..abc.com/",
"MyService"));

MyService port = service.getMyServiceImplPort();

try {

((BindingProvider) port)
.getRequestContext()
.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
"https://localhost:7001/myContext/MyService?WSDL");
// ((BindingProvider) port).getRequestContext().put(
// BindingProvider.USERNAME_PROPERTY, "myusername");
// ((BindingProvider) port).getRequestContext().put(
// BindingProvider.PASSWORD_PROPERTY, "mypassword");
// ((BindingProvider)port).getRequestContext().put(MessageContext.HTTP_REQUEST_HEADERS,
//    Collections.singletonMap("Content-Type",Collections.singletonList("text/xml")));

} catch (Exception e) {
throw e;
}
com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true;

                port.calculate(3,5);

Herkese iyi günler.

Hiç yorum yok:

Yorum Gönder