• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

Invoking an https web service

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I 've written the following code to invoke an https service:
System.setProperty("javax.xml.soap.MessageFactory","weblogic.webservice.core.soap.MessageFactoryImpl");
System.setProperty("javax.xml.rpc.ServiceFactory","weblogic.webservice.core.rpc.ServiceFactoryImpl");
System.setProperty("java.protocol.handler.pkgs", "com.certicom.net.ssl");
SSLAdapterFactory adapterFactory = SSLAdapterFactory.getDefaultFactory();
WLSSLAdapter adapter = (WLSSLAdapter) adapterFactory.getSSLAdapter();
adapter.setStrictChecking(false); //optional
adapter.setTrustedCertificatesFile("s.crt");
adapter.setVerbose(true);
adapterFactory.setDefaultAdapter(adapter);
adapterFactory.setUseDefaultAdapter(true);
ServiceFactory factory = ServiceFactory.newInstance();
String targetNamespace ="http://webservice.jopay.egov";
QName serviceName = new QName(targetNamespace,"VirtualPSPWebServiceService");
QName portName = new QName(targetNamespace,"VirtualPSPWebService");
QName operationName = new QName("execute");
URL wsdlLocation = new URL( "https://???:443/GOJPAYDV/services/VirtualPSPWebService?WSDL");
Service service = factory.createService(wsdlLocation, serviceName);
call = service.createCall(portName, operationName);
call.setProperty("weblogic.webservice.client.ssladapter", adapter);
TypeMappingRegistry registry = service.getTypeMappingRegistry();
TypeMapping mapping = registry.getTypeMapping(SOAPConstants.URI_NS_SOAP_ENCODING);
mapping.register(Execute.class, new QName(targetNamespace,"execute"),new ExecuteCodec(),new ExecuteCodec());
mapping.register(ExecuteResponse.class,
new QName(targetNamespace,
"executeResponse"),
new ExecuteResponseCodec(),
new ExecuteResponseCodec());
Execute execute = new Execute();
execute.setClientId(PaymentGatewayWS.OPSPID);
execute.setMessageCode(msgCode);
execute.setMessage(msg);
execute.setSignature(signature);

ExecuteResponse response = (ExecuteResponse) call.invoke(new Object[] {
execute});

But i've got the following Exception with warning messages on the certificate:
[BaseWLSSLAdapter] : Got new socketfactory javax.net.ssl.impl.SSLSocketFactoryImpl@1976011

[BaseWLSSLAdapter] : Returning socket Socket[addr=???,port=443,localport=2633]com.certicom.tls.interfaceimpl.TLSConnectionImpl@5b8827

[BaseWLSSLAdapter$NullTrustManager] : Warning: cert chain incomplete

[BaseWLSSLAdapter$NullTrustManager] : Warning: subject (???, OU=Domain Control Validated - RapidSSL(R), OU=See www.rapidssl.com/resources/cps (c)08, OU=GT78392506, O=svn.sts.com.jo, C=JO) does not match server name (null)

The XML stream parser could not find the start element.

java.io.IOException: start element not found

at weblogic.webservice.xml.XMLNode.read(XMLNode.java:681)

at weblogic.webservice.xml.XMLNode.read(XMLNode.java:670)

at weblogic.webservice.tools.wsdlp.DefinitionFactory.createDefinition(DefinitionFactory.java:117)

at weblogic.webservice.tools.wsdlp.WSDLParser.<init>(WSDLParser.java:66)

at weblogic.webservice.WebServiceFactory.createFromWSDL(WebServiceFactory.java:108)

at weblogic.webservice.WebServiceFactory.createFromWSDL(WebServiceFactory.java:84)

at weblogic.webservice.core.rpc.ServiceImpl.getWebService(ServiceImpl.java:97)

at weblogic.webservice.core.rpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:41)



javax.xml.rpc.JAXRPCException: failed to create service


Any help will be appreciated.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic