I am trying to consume an existing web-service from another company and have troubles to find a solution to use the same web-service from different location.
An existing web-service is available at the address http://url.to.A/webservice/ and I am able to generate a C++ proxy class for this service using sproxy.exe from the ATL tools.
Using that class, I can consume the web-service without any problem.
Now I need to consume the same web-service but from another URL (let's say http://url.to.B/webservice/) and the previously created proxy class is not working. The SendRequest method inside one of method proxy always returns an erroneous HRESULT code. Generating a new proxy specifically for this second service gives a working solution BTW.
When I say that the services are the same I mean that they expose exactly the same methods so that their respective wsdl definition files differ only by the service URL.
I've tried to change the URL property of the generated proxy class instance but it doesn't help.
Given that I am tied to use unmanaged C++ for the consuming part and that I would like to be able to specify the service endpoint at runtime, is there a viable solution to my problem?
Thanks for your help.
Generate a separate proxy class for each server/service.
Then do a diff on the generated code. That should let you know what the differences are.
It finally turned out that it's not possible, using sproxy.exe, to generate a class that can be dynamically assigned to a webservice endpoint.
Related
This is with respect to a JAXWS webservice. In a library (jar), besides many other classes, I have all the classes generated by wsimport, and the implementation class.
Two separate (EAR) applications depend on this library for different reasons.
In one application, I would like the webservice to be not started (not available), in the other application I would like the webservice to be up and running.
I did not write any Java code explicitly to start the webservice. I think, since the implementation class has #WebService annotation, and so, the environment automatically makes the webservice available.
If instead there is a way to manually start (publish) the webservice, and not use the automatic means, then we can do the manual publishing/starting in one of the application where it is desired.
Any ideas?
It seems that most of the new kids on the block are using RESTful web services rather than SOAP. I've only dabbled in them enough to know the basics of how they work.
Essentially in a SOAP implimentation, you are able to use a WSDL file that describes data types as well as usable RPC's. Finding a WSDL file and simply adding it as a service reference in visual studio is awesome and easy to impliment.
In a REST web service you have one (or more, depending on overrides) method for each action you are wanting to take (GET, POST, PUT, DELETE). While I can see how this would be beneficial, I can see problems with this... such as still having to deserialize into a local object.
So my question is... can you actually get intellisense when consuming REST web services? When you add a service reference to a WSDL you are able to see the list of usable methods. Otherwise, is the only way to actually see the usable methods through documentation? Is there any "self-containing" document that describes to VS what you can use and/or how to interpret data types without having to deserialize/serialize.
Is there is any possibility (special approach or wsdl2cfc utility) to generate web service (or it’s stub) with complex input output parameters and custom failure messages based on specified WSDL? I’ve read a lot of articles which describe how to consume that type of web services, but I haven’t found any article which describes how to implement them.
you can specify the WSDL a CFC presents with the wsdlfile attribute, so you can certainly present an existing WSDL, if that's what you've got. Getting CF to map things properly when the service is invoked is another matter. I would start by taking the WSDL you have, making a CFC use it and implementing the right method names with no specified arguments and CFDUMPing the arguments structure to see what CF is getting.
You can do quite a lot to present the web service you want by using CFCs with the right names and CFPROPERTY tags in them. You can also specify in a CFARGUMENT that the type="foo[]" and the generated WSDL will expect a list of FOO objects to be passed in.
I've no experience with returning custom errors through a web service, you may have to play with what CFTHROW does from within a web service
I assume you're trying to implement a service that already exists?
Just once to get the address location and use it forever?
Every time a call is made?
Or some time in between?
The only purpose of the WSDL URL is to return the WSDL that describes the current service.
The only reason to ever read it is if the reader does not have the WSDL that describes the current service.
The only time a reader would need to read it is if they never had the WSDL that described the service, or if the service has changed.
Some downlevel clients are pretty stupid and need to download the WSDL before each call. Avoid them.
It depends what you are trying to do. If you're calling or referencing the Web Service...you will need to re-reference it when the Web Service interface changes. If the Web Service interface won't change, then you only need to reference it once
I agree with John and would add that in most cases you don't need the WSDL to be hosted on a URL at all. Unless you have a public web service that anyone can sign up and use you're probably better off to keep the wsdl to yourself and only fork it out to specific users as needed.
We are trying to consume web services with ColdFusion.
I am able to interact with the web service for the most part, however, there is one service where ColdFusion is throwing a "Parameters Could Not Be Found" error because the response message in the WSDL for this particular service is a blank parent class. I need to add the specific parameters of corresponding subclass that inherits the class pointed to in the service of the WSDL.
Is there a way to tell ColdFusion to use a certain class definition for the parameters?
Or, is there a ColdFusion tool for showing the acceptable parameter formats for a given WSDL?
EDIT
Or, is there a way to hook into the ColdFusion code that does the parsing/conversion of the parameter structure from the WSDL?
My guess is that even finding a third-party tool will not help much because I need to know what ColdFusion is going to do, not what the data SHOULD be; I know what it should be.
You can use your own WSDL file, you don't have to use the one generated by ColdFusion, just generate one, customize it and point people to your custom WSDL file instead of the YourComponent.cfc?WSDL url.
This article on consuming complex web services may help:
http://tjordahl.blogspot.com/2008/04/reprint-consuming-web-service-complex.html
Also note that if you have a copy of Dreamweaver laying around, it has a tool for inspecting WSDL and generating the required ColdFusion code.
Or, is there a ColdFusion tool for showing the acceptable parameter formats for a given wsdl?
Please see this SO question and answer
Maybe my code samples can help you.