Question

(I am using eclipse)

I am new to Axis dynamic webservice client call. I have coded like below

cEAServiceAvailRequestModel = getCEAServiceAvailRequestModel();


org.apache.axis.client.Call call =   (org.apache.axis.client.Call)        
     getWSDLCallObject(wsConfig.getProperty("WsdlUrl"),
    wsConfig.getProperty("MethodName"),
    wsConfig.getProperty("PortName"),
    wsConfig.getProperty("PortLocation"),
    wsConfig.getProperty("ServiceName"),
    wsConfig.getProperty("TargetNameSpace"),
    wsConfig.getProperty("HandlerInfo"));

call = returnCAMEOCall(call);

Object[] objectList = new Object[1];
objectList[0] = cEAServiceAvailRequestModel;
CEAServiceAvailResponseModel responseModel = (CEAServiceAvailResponseModel) call
                .invoke(objectList);
CEATypeAvailModel[] availabilityList = responseModel
                .getAvailabilityList();

System.out.println("Final Response : " + availabilityList.toString());

     } catch (Exception e) {
    // TODO: handle exception
        e.printStackTrace();
}
}

public static Call getWSDLCallObject(String wsdlurl, String methodname,
        String portname, String portLocation, String servicename,
        String targetNameSpace, String handler) {
Call call = null;
try {

    QName vnposvcName = new QName(targetNameSpace, servicename);            
    QName portName = new QName(portLocation, portname);
    QName methodName = new QName(portLocation, methodname);
    QName wponame = new QName("http://wpo.verizon.com", "wpo");
    QName[] qnames = new QName[] { wponame };
    ServiceFactory factory = ServiceFactory.newInstance();
    javax.xml.rpc.Service service = factory.createService(new URL(
            wsdlurl), vnposvcName);

    if (handler != null) {
        java.util.List list = service.getHandlerRegistry()
                    .getHandlerChain(portName);
        HandlerInfo handlerInfo = new HandlerInfo(
                    Class.forName(handler), null, null);
        list.add(handlerInfo);
    }

    call = service.createCall(portName, methodName);

} catch (Exception e) {
    e.printStackTrace();
    return null;
}
return call;
}

//I am getting exception like below

java.lang.ClassCastException: weblogic.webservice.core.rpc.CallImpl at com.verizon.cameo.CameoWebServiceClient.CameoAddressValidation(CameoWebServiceClient.java:63) at com.verizon.cameo.CameoWebServiceClient.main(CameoWebServiceClient.java:21)

Was it helpful?

Solution

Finally, I got solution that we have to set VM arguments to for the type casting like below

-Djavax.xml.rpc.ServiceFactory=org.apache.axis.client.ServiceFactory 
-Djavax.xml.soap.MessageFactory=org.apache.axis.soap.MessageFactoryImpl
-Dweblogic.webservice.client.ssl.trustedcertfile=C:\bea\bea1035\wlserver_10.3 \server\lib\trusted.crt 
-Dweblogic.security.SSL.verbose=true 
-Dweblogic.webservice.verbose=true 
-Dweblogic.webservice.client.verbose=true 
-Dssl.debug=true 
-Dweblogic.webservice.client.ssl.strictcertchecking=false

Now, I can able to make the web service call.

Thanks

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top