Lack of performance consuming Java Web Service in .net
I have been consuming a Java Web Services in .net 3.5 but I have seen a lack of performance during the first time the web service proxy is created.
I Added the WebService reference using Add Service reference feature. At this point the WebService reference is created开发者_如何转开发, the next step is to create a proxy instance to consume the Web Service.
The enpoind that I have been using (let's say is is http://crdevelopment/services/SalesService) contains 250 soap methods.
So when I try to consume a single WebMehod , ie getCustomersLocation
, I do the following line of code
var serviceResult = new SalesProxy(http://crdevelopment/services/SalesService?wsdl);
This line takes long time, I'm assuming it is because the endPoint does has a lot of web methods.
Then , I consume the method
var customerLocations = serviceResult .getCustomersLocation("San Jose").
The execution of the Web Method does not take time, but the proxy creation does.
My question is, Why is the proxy object instance taking long time , even when I have added the Web Service reference and the proxy must have been created?
Does that make sense for you?
Looks like you have a wrong URL (?wsdl at the end):
var serviceResult =
new SalesProxy("http://crdevelopment/services/SalesService?wsdl");
Should not it be something like:
var serviceResult = new SalesProxy("http://crdevelopment/services/SalesService");
If I understood you correctly, you don't need WSDL at runtime because proxy is generated at design time. It may explain the issue because generated proxy might be loading WSDL for no reason and it can cause a delay.
UPDATE:
Looks like you might be experiencing delays related to XML serialization in SoapHttpClientProtocol constructor. See this question, it contains few possible solutions. Additionally you may want to try generating WCF client/proxy and use it instead. You need to use "Add Service Reference", not "Add Web Reference", the difference is outlined here.
精彩评论