Amanuel Nega
Amanuel Nega

Reputation: 1977

Java SOAP client very slow

I am building a client for a web service. I didn't want to the client downloading the wsdl everytime and got this answer.

But evaluating the source files of WSServiceDelegate,

URL url = wsdl.getSystemId()==null ? null : JAXWSUtils.getEncodedURL(wsdl.getSystemId());
WSDLModel model = parseWSDL(url, wsdl, serviceClass);                                    
service = model.getService(this.serviceName);                                            
if (service == null)                                                                     
    throw new WebServiceException(                                                       
        ClientMessages.INVALID_SERVICE_NAME(this.serviceName,                            
            buildNameList(model.getServices().keySet())));                               
// fill in statically known ports                                                        
for (WSDLPort port : service.getPorts())                                                 
    ports.put(port.getName(), new PortInfo(this, port));                                 

I see that it still parses the wsdl to get the service. How can I get around that. I provided the endpoint url using the context.

I need the client to be as fast and as small as possible, adding a huge wsdl in there is worst than downloading the wsdl.

Upvotes: 0

Views: 1235

Answers (1)

Taurai Nyamakura
Taurai Nyamakura

Reputation: 543

For the operations you are interested in, you can build your own SOAP messages based on the wsdl's Request/Response messages and the xsd. You can use Jaxb tools to convert from XSD to Java classes. You then need to make post calls using Http Clients (like Spring RestTemplate) to post the POST body, soap based, to the endpoint address. This will make your calls faster but you have to code more in order to benefit.

Upvotes: 1

Related Questions