1
votes

I want to add a service reference in Visual studio 2012, I have a wsdl file and I don't have url to type in url box. I add wsdl file path in my local computer to url box, is it ok? when I add this wsdl file to soapUI its work and return true data in response, but when I add this wsdl file path to visualstudio it not work(return null when I call the method), its force.

in the wsdl file the service url is "http://xxx.xx.xxx.xxx/soap" (and soapUI use this url) but Visual studio don't accept this url because it doesn't have xxx.asmx postfix?

I add the wsdl file path to url box in visual studio and vs generate some files, then I create instance of that service and call web method, like this:

service1.xxxServicesClient proxy=new service1.xxxServicesClient ;

service1.RequestType request= new service1.RequestType;
request.param1="123";
service1.ResponseType response= new service1.ResponseType ;

response= proxy.methodx(request);

I build successfully that, but I get null in response when call the methodx()! I add this wsdl file to soapUI and pass same parameter and soapUI return data(work fine)!

I do not know technology of destination web service, maybe it's a java web service.

1
The postfix has nothing to do with it. What made you think so? .asmx is not used for new development, so that's definitely not your problem.John Saunders
i get null from web service in visual studio but get data from soap ui! whats the problem?user2119213
The problem is that you're not saying what you mean by "I get null from web service in visual studio". Show some code. Also, FYI, this happens frequently with services which are non-standard. What technology created the service? This was often a problem with old versions of Axis, for instance.John Saunders
thanx for helping john, i edit my question, please help me....user2119213

1 Answers

0
votes

it's ok , you can use wsdl file in local computer. you get response in soapUI it' means good, so the destination web service work fine. on resonse panel and request panel right click and chose validate(soapUI v5), for validate xml format. i guess that xml format invalid, try it.

visual studio return null when it can't prepare response data to xml schema (that specify in wsdl). so, your code is ok, if format is invalid, call destination web service developer and ask to them check web service configurations and wsdl (xml) format.