checking validity for standard SOAP web service - visual-studio-2010

Is this a valid web service link since I tried ti import it several times to visual studio 2010 and 2012 and couldnt read it from code behind.
http://www.hotelston.com/ws/HotelService?wsdl
whats the service name I should call ?

Yes this is a valid WSDL and it is a WSI compliant WSDL as well. I ran the tests with SOAP UI and it appears to be fine. The service name is HotelService it has three ports one for SOAP 1.1 another for SOAP 1.2 and finally one for HTTP. It is document literal wrapped so cant see anything problematic.
I also imported the WSDL into a XML editor and had a look. It appears fine see image below.

Related

Magento API not working with wsdl.exe but works with Soap UI

I'm trying to integrate Magento 1.7 with a C# application.
When I tried to use the "Add Service Reference" function in Visual Studio, it finds the service and all the operations but when I click OK, it doesn't generate anything. i.e. the Reference.cs file is almost empty (only has one line with namespace).
I tried using wsdl.exe to generate the proxy in command prompt and I got the following error:
R2718: A wsdl:binding in a DESCRIPTION MUST have the same set of wsdl:operations as the wsdl:portType to which it refers.
- Operation 'catalogProductAttributeRemove' on portType 'Mage_Api_Model_Server_Wsi_HandlerPortType' from namespace 'urn:Magento' has no matching binding.
For more details on the WS-I Basic Profile v1.1, see the specification
at http://www.ws-i.org/Profiles/BasicProfile-1.1.html.
Error: Unable to import binding 'Mage_Api_Model_Server_Wsi_HandlerBinding' from namespace 'urn:Magento'.
- The operation 'catalogProductAttributeRemove' on portType 'Mage_Api_Model_Server_Wsi_HandlerPortType' from namespace 'urn:Magento' had the following syntax
error: The operation has no matching binding. Check if the operation, input and output names in the Binding section match with the corresponding names in the PortType section.
I then tried using Soap UI to load the same wsdl and it works fine. The proxy was generated and I can make calls without any problems.
The original wsdl file is here: https://gist.github.com/4514723
except I have replaced line 6297 with an example url.
So my questsion is why was Soap UI able to generate the proxies and making calls without any problems but Visual Studio can't? How can I fix it?
See Generate a Web Service Client in WS-I compliance mode .
You will need to modify your Magento code to correct the WS-I compliant WSDL definition in app\code\core\Mage\Catalog\etc\wsi.xml.
The SOAP UI is probably more tolerant of mistakes in WSDLs compared to other .NET/Java tooling.

webapi batch requests

I am looking for a way to batch requests to the server. I found a post by Brad Wilson outlining how to make a batch handler using a message hanlder http://bradwilson.typepad.com/blog/2012/06/batching-handler-for-web-api.html#more but I wasn't able to get this working.
first I had compile errors because webapi did not understand "route-specific endpoint handler" like Brad's example used. there were also problems with the media type and/or formatter (can't remember which). My next attempt was to make a batch controller. so instead of a batch handler I had a batch controller. I almost has this working except when I used the MessageHandlerInvoker to call the individual commands I got exceptions about the additional handlers I have regsstered (1 for logging request/response and another to mimic user authentication).
At that point I stopped and reverted back to individual requests, not ideal, but it works.
My environment:
.net 4.0
VS 2010
mvc 4 front end (calls webapi)
webapi as a service tier
Has anyone else had any success with batched messages and webapi?
To be able to use per-route handlers you need ASP.NET Web API RTM which was only released yesterday (at the time when Brad wrote the article, it would only work with nightly MyGet feed builds or against Codeplex source).
You can get entire MVC4 RTM here or simply off Nuget.

Dynamically set URL of web service

Scenario: I'm running code on the client that connects to a server and uses a web service to retrieve data about a SharePoint list. I'm using the Visual Studio 2010 "service reference" to get a web service for my SP Site and get my data from the list. It works. Now how do I go about coding it such that when I want to move from Test to Production, my web service calls will still work? Note that the web service is a SharePoint web service, I did not write it. I am only using it. Is what I am suggesting possible? I do have the ability to ensure that the Site is the exact same (except for URLS) on both environments (e.g. backup the SP site and put it on production). Thanks for any suggestions.
Summary:
Basically I'm looking for the best way to go from test to production without re-compiling my code which consumes the SP web service. Also, as a side note, if anyone knows how similar the test/production sharepoint sites have to be, [in order for the web service to work on both without anything but the URL being changed].. that would be helpful info.
Solution
The project configuration file can be used to specify the web service location. The .svcdatamap and other files in the VS project are for design time use only, and the URL which is actually used to connect to the SharePoint web service is passed as an argument to the System.Data.Services.Client.DataServiceContext object. This is only tangentially related, but to create your own WCF web service see this link. BTW, the web service will work without recompilation anywhere the SharePoint List has the same List name and the column you're querying has the same name.
As far as I know, Visual Studio Tools for Office projects allow you to have an app.config file in your project. I'd expect that Visual Studio created the app.config file and added the necessary configuration settings related to the web service reference. In any case, you need to store the correct web service url somewhere - app.config, registry or even a database.
If you are not able to store the web service endpoint address information in the app.config file, there's a way to configure the proxy manually.
If it's a .asmx reference added as a legacy "Web Reference" in Visual Studio then all you need to do is set the Url property value of the proxy object before you call any web service methods. For example:
MyASMXWebService proxy = new MyASMXWebService();
proxy.Url = "web service url";
proxy.HelloWorld();
If it's a .svc WCF service reference then things get a bit more complicated. You'll need to create your web service endpoint programmatically. For example:
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress endpoint = new EndpointAddress("web service url");
ChannelFactory<IMyWCFWebService> factory = new ChannelFactory<IMyWCFWebService>(binding, endpoint);
IMyWCFWebService proxy = factory.CreateChannel();
proxy.DoWork();
Since SharePoint services (SVC) do not provide a proxy, option 2 will not work. References to both locations must be included in your application and then use a parm to differentiate production from test. I believe 2013 will likely correct this bug.
You have to edit the URL in your project's web.config
Simple SharePoint example:
MyService.ListsSoapClient client = new MyService.ListsSoapClient();
client.Endpoint.Address = "site url"+"/_vti_bin/lists.asmx";

How to add search.asmx web reference to webpart application in VS2008 ? facing problem

I am trying to create the custom search webpart. I want to use Enterprise Search Query Model (MOSS) . But unable to add the web reference of the search.asmx webservice. infact it has no WSDL file. just wondering about what setting it needs.... too If anybody know how to do, same. please let me know. you can find the search webservice at
Edited : "http://server_name:port_no/sites/site_name/_vti_bin/search.asmx"
I tried by right cliking on project said Add Service Reference , inserts the url said Go , but nothis was there. same i tried with web aplication . but no effect. even i can see the methods in browser, but cannot generate WSDL ??
You are using the wrong url.
http://PORTAL/_vti_bin/spsearch.asmx is for WSS3.
http://PORTAL/_vti_bin/search.asmx is for MOSS.
Also check out a test tool for searching SharePoint 2007.
Problem solved. browse searchwsdl.aspx in browser. it generates the wsdl (xml) format file. just give the web reference to the application. that it.

How can I get started using a WSDL file with Visual Studio it's in the root of the project instead of being hosted on the internet somewhere

I've been tasked when integrating a web form into Oracle CRM on Demand (Siebel) using web services. I've been given the WSDL, and some high level documentation from Oracle.
Well, I knew I was in trouble when I tried to add the WSDL as Web Reference and I was asked to enter an URL. I have the WSDL file in the root of the project, but I have no idea how to link to it.
So, I guess that means I need to learn up on web services using C# and Visual Studio. I have a Safari Books Online account, so I can look up most anything.
It's been a while, but I'm OK at the form part. I just need help connecting and using the web service.
Edit #1: Ok, to clarify my question: I am well aware on how to use web services in general. My specific question is how take this WSDL file and do something with it. If the WSDL was hosted somewhere else, I could just add it as a Web Reference. But, I have the file in the project itself and that is what I am having problems with.
The web reference asks for a URL but you can point it to a local file. Just paste the local file path of your WSDL in and it should work.
Further Clarification of Web Reference URL vs URL to access Web Service
Web Reference URL is used to generate and update wrapper classes for WSDL/Web Service. It is not the URL used at runtime to access Web Service.
URL property on generated wrapper classes is used to access actual web service at runtime.
Update:
It should add a path in the web.config or app.config/settings file (Depending on your project type) similiar to the following:
<setting name="Namespace_WebReferenceName" serializeAs="String">
<value>XXX</value>
</setting>
Which should map to a URL property in the generated web reference wrapper classes. You can modify the URL property programmatically to point wherever you want:
Dim shipService As ShipService = New ShipService() 'Initialize the service - where ShipService is the Generated WebReference Wrapper CLass
shipService.Url = ConfigurationSettings.AppSettings("FedExOnlineURL")

Resources