I am trying to establish a connection using the ruby gems Savon and execute SOAP requests and responses. The thing is that I am getting the file each time by doing this:
client = Savon.client("http://www.webservicex.net/uszip.asmx?WSDL")
Now in the documentation of Savon it says this:
"You can instantiate a client with or without a (local or remote) WSDL document. Using a WSDL is a little easier because Savon can parse the document for the target namespace, endpoint, available SOAP actions etc. But the (remote) WSDL has to be downloaded and parsed once for every client which comes with a performance penalty."
So my question is, can I get the WSDL file by just using the Savon Library? Or do I need to ask for it from the third party application?
It depends on the service, and whether or not they offer the .WSDL from their service URL. Best bet for availability may be to store the WSDL locally, but at that point you commit yourself to tracking their updates
Related
In the beginning I have to warn that I'm not familar with web services, I want to simply generate what I need, and learn the basics of usage.
I recived .wsdl and .xsd files (stored localy). I have generated java code using Apache CXF WSDL2Java tool (I have generated a client). I also have an endpoint (as url without '?WSDL' on the end - whatever this endding means). How can I set this endpoint?
If I use:
Blachblach_Service ss = new Blachblach_Service(new URL(recived_url));
Blachblach port = ss.getBlachblachSOAP();
I get an exception. When I use soapUI to send XMLs to web services, everything works fine.
At first you need to initialize your web service client. See my answer over here how to make this work.
?WSDL ending means that you can see the web service WSDL file in your browser, you can access the web service through SOAP protocol by providing it with some valid request.
If you need to create your web service client using Spring. Here is very good example how to do this.
Yes usually we set params like end point URL on Service class object and retrieve port from it. and from port we invoke web service methods. can you please give details of exception you are getting?
is it possible with SAP to generate client stubs and transfer objects from a WSDL served by a .NET WCF web service? Or do I have to build my SOAP XML requests manually?
To be more on the point. I still have a WCF web service and the wsdl. I have no knowlege in SAP. So the question is. Is it possible and how can I create client service stubs and the transfer objects in SAP from my WSDL?
It's easy to create an ABAP client for an existing web service if you have access to the URL for obtaining the wsdl file or the wsdl file itself. See this link for an step by step tutorial wich is basically:
1- Generate proxy from wsdl using assitant
2- Use proxy generated in your ABAP program
Regards
You can use the WSDL from the wcf for this. You can get the WSDL as service.svc?wsdl. However at times, some SOAP client generator expect all the definitions of the SOAP/WSDL in a single call. For that you might have to look at the following pages:
http://weblogs.asp.net/pglavich/archive/2010/03/16/making-wcf-output-a-single-wsdl-file-for-interop-purposes.aspx
http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/f03b6e78-ef28-4692-8f19-62d2f2d3bc9c
WCF: how to generate a single WSDL document, without WSDL:import?
Caution, WCF noobie alert
I need to create a WCF client to query a non-WCF web service.
The web service is not a WCF service. Additionally, the web service requires a client authentication certificate. Now, I have the certificate, and can create a non-WCF client that works perfectly; I was able to 'Add Web Reference' and a certificate dialog box opened up to allow me to select the appropriate certificate, then went on to create the web reference. Trying to create a WCF client via 'Add Service Reference' is another story, it just fails with a 403 Access Denied error.
I have the WSDL for the service, and have run svcutil.exe on it, but am not sure how to proceed from there.
Thanks for any help!
I'm assuming that the service you are using is performing client SSL authentication.
Since add service reference is failing, you can use svcutil to generate the client from the WSDL file that you have. I think the syntax would be something like:
svcutil *.wsdl /l:C# /out:Reference.cs /config /s /ct:System.Collections.Generic.List`1 /ser:Auto /tcv:Version35 /n:*,<NameOfYourNamespaceHere> /edb
This will generate a file, Reference.cs, that contains the proxy classes to the service (you can give this file whatever name you want). Add this file to your project. A config file, output.config, will also be generated. You can add this configuration to your application configuration instead of typing it all in by hand.
Now you can follow this MSDN article on using Transport Security with Certificate Authentication. You can skip down to the client section where it shows how to attach the certificate to the request in code as well as in configuration.
I know this is the old question and it has been already solved but I would like to mention that Add service reference also works for WSDL files stored on disk. Marc has also mentioned it. Add service reference dialog accepts:
URL to WSDL
URL to Metadata exchange endpoint
Service URL where /mex is added internally
Any file path to WSDL file
So if you have WSDL and all need XSD files you can use Add service reference as well. The only tricky part is that Add service reference dialog doesn't have Browse button and that is the reason why this functionality is not well known.
Stupid question (maybe): could you connect to the service endpoint, present it with your credentials stored in the certificate, and then download the WSDL (and possibly XSD) from there? Or could it be the entity offering this service would be able to actually send you these files (or make them available for download)?
Once you have the WSDL (and XSD) file on disk, it should be easy enough to create WCF client for that (using either svcutil.exe or Add Service Reference) based on those files, and then configure the appropriate security for it.
Just a thought.... (worth $0.02?)
Marc
OK, bit of a work-around here (and I've no idea what is going on technically): I noticed that when you add a Web Reference, the certificate you have chosen is cached and automatically used the next time you add the Web Reference (I noticed because I'd chosen the wrong certificate). This caching seems to work across Web Reference and Service Reference so:
Add a Web Reference to the endpoint, choosing the certificate you wish to use
Remove this Web Reference
Add a Service Reference to the same endpoint and Visual Studio will use the same certificate you chose for the Web Reference
Worked on Visual Studio Community 2019, v16.7.7
I have a wcf web service and I need to provide the client with the wsdl files.
Previously I used svcutil on the .dll and everything was fine.
However, recently I implemented the factory to Flaten the wsdl file (re: http://wcfextras.codeplex.com/).
My questions is this: Is there anyway of either using svcutil on the .svc to extract the Flattened .WSDL files or maybe somehow hit up the web service when it is running in the local webdev server to retrieve the .WSDL files?
As far as I'm aware, if I was to navigate to my local web dev server (http://localhost:2916/Service.svc?wsdl) and if i was to view source and saved that as .wsdl that this is wrong and would not provide all the relevant information.
note: See below for how the Factory is used in the .svc file....
<% #ServiceHost Factory="CompanyName.ServiceModel.Extensions.Description.FlatWsdlServiceHostFactory" language=c# Service="CompanyName.WebServices.Service"%>
Thanks,
Steven
Yes, you should still be able to use svcutil to extract the WSDL from your service, even if you have an extension installed that will flatten the WSDL.
To download the metadata document(s) from your running service, use this command:
svcutil /t:metadata http://service/metadataEndpoint
You need to point your URL to the metadata endpoint defined in your config, e.g. the endpoint that's defined to use "mexHttpBinding" or "mexTcpBinding" and the "IMetadataExchange" contract.
If you don't have any metadata exchange endpoints defined, you won't be able to retrieve that information, obviously.
I want to invoke a wcf service for testing on the http layer. I do not want to add a service reference and create a proxy and invoke. I want to create a new web test(VSTS) which sends a http request to the service and posts(Http post) the request in http body as an xml.
I have service metadata, with which I can see the datacontracts, but the wsdl:operation has only the operation name, wsdl:input is just blank.
On the Contary, an asmx service will have the soap request in the metadata which can be copied as the http request body, with the parameters replaced.
How to build a wcf service xml body from scratch just by looking at the service metadata (no access to the service logs as well), have got just the end point.
It is something like
<root>
<element1>element1</element1>
<element2>element2</element2>
</root>
But, how to find out this, root has to be some thing like
<FunctionRequest xmlns=""http://schemas...."" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"">
(tested for a local service and worked)
Now, without having access to service logs(svctraceviewer logs), not able to add a service reference, not able to use svcutil.exe(certificate based service), just only with metadata - wsdl, is there a way to find out the request that is to be sent to service?
Well, you will have to create proxy - either statically by adding a service reference or running svcutil on your service metadata, or you can construct it dynamically totally in code, if you wish.
In that case, you'd have to have your service contract (ISomethingService) at hand, and check out the ChannelFactory < ISomethingService > () concept - that should get you started.
Marc
Yes you can, but you have to do a little work first.
Build the service client by running svcutil.exe on the wsdl/xsd metadata. This will generate a c# with your service and data contract objects. Compile that to an assembly using csc.exe.
See the soap envelope body you can create a request object and manually serialize it with data contract serializer. Or you can host the assembly in WcfSvcHost.exe and add wcf logging to the config file. In either case you will only have the correct xml for the body, and even that might be wrong if the real service uses xml serializer instead of data contract serializer.
The next part is the hard part because you need to know the security model for the real service. If it only uses certificates for SSL and server identification, you should be able to send the xml using WebClient. But if it uses mutual certs and/or security tokens, you pretty much have to create a channelfactory by hand with the right bindings.