I have been given a "working" SoapUi 4.0.1 project that accesses an existing 3rd party service. The project has two xml requests that I can run to see, in SoapUi , a "found" and a "not found" response.
Along with the project is a wsdl file a couple of certificate files (for message security) and a bunch of xml schemas.
I've been told to implement a c# client that uses the service based on the "documentation" provided by the above.
I'm not experienced in the intricacies of WCF configuration nor SoapUi. There, at least, there seems to be a mismatch between the terminology SoapUi uses and that I see in the WCF configuration tool.
I'm looking for advice, hints, pointers on duplicating the SoapUi calls in my .NET code, perhaps a terminology mapping between the two tools would be a good start.
First you need to create a service proxy using the right-click "Add Service Reference" in Visual Studio or by running the SVCUTIL.EXE tool from a VS command-line. This will provide you with both a basic configuration file as well as a client implementation. All you need to do this is the actual metadata files (WSDL+XSD) or a URL to a hosted version of it.
It is not clear weather the SoapUI project you have makes client requests to the actual service or if it uses the built-in MockService feature where SoapUI hosts a 'fake' service instance. Either way the MockService feature can be your best friend doing WCF development.
If you are using the SoapUI MockService feature and do not have the original WSDL or access to it you can then use the metadata exposed by the MockService. One way of finding the link to the WSDL is by clicking the link button:
Copy the URL you get from there and generate the proxy from a Visual Studio command-prompt:
svcutil.exe http://localhost:8088/mockKramerServiceSoap?WSDL
SoapUI has one really great feature when trying to replicate SOAP calls in WCF. You can examine requests coming into the MockService from the .NET proxy and compare them with the calls made from SoapUI.
Hopefully this helped you getting started.
Related
We are consuming a WCF service using coldfusion. the wcf service does not expose metadata endpoint instead they share service contracts in dll and svcutil.exe generated proxy class.
Now, how can i consume the wcf service in coldfusion without generating proxy.? i see .net client can access that way by creating channel factory as given in the following url:
http://www.c-sharpcorner.com/UploadFile/dhananjaycoder/accessing-wcf-service-without-creating-proxy/
i researched adobe help page:
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-78b4.html
but there is no clue.
what possibilities i have to consume the service?
I don't understand the question. Let me see if I can figure this out:
No proxy would be involved unless you specify one. The client computer will invoke and consume the web service on the server without anything inbetween. It's a standard HTTP call.
You say you are connecting to svcutil.exe, a c# utility. So you seem to mean you have an additional layer between the two CF applications, correct? So svcutil.exe is acting as the "proxy"?
Forgive me if the question is incoherent.
I find WCF really complicated. Moreover, different ways to do the same thing make a beginner even more befuddled, like hard-code a host vs config file, or hard-code a client vs add service reference. (Am I feeling right?)
I think it would be helpful to try to go through the process with code in a primitive way. No service reference, no config file.
Maybe I can put it this way: If the service is running on another machine (or my machine pretending another machine), what are the minimum things it has to provide beside an address for some one to consume it?
And how can I consume it with code?
Add Service Reference parses the WSDL of the service to import the service contract, and potentially any referenced domain types, into the client's representation (in this case, C#). It generates a proxy which exposes a C# interface that represents the service contract. The proxy is a namespace and set of classes with methods to call each service method for the particular endpoint.
In short it takes service contract metadata and reifies it to C#.
You can also manually generate the proxy with 'svcutil.exe'
svcutil http://server.com/FooService/FooService.svc /out:FooProxy.cs
Or to include generation of the app.config as well
svcutil http://server.com/FooService /out:FooProxy.cs /config:App.config
Visual Studio "Add Service Reference" does that for you, plus adds the new files to your project.
I have created two wsdl files with shared types imported from xsd schema file.
After that I have created web services using interface generated by wsdl.exe tool with parameter /serverInterface.
Frist web service, have web method “RegisterData” with put into queue some complex object to be processed, by system “A”. As result of this method is returned Boolean (with tell us that object was registered successful).
Second web service, have web method “UpdateData” to update some data in system “B” based on this same object , with was changed in process on system “A”.
So in system “A” I have to create client for second web service, where I will call method “UpdateData” with this modified complex object us argument.
But when I’m creating this client in Visual Studio (by add web reference or add service reference) I have to create some namespace for client. And then when I’m trying to call “UpdateData” agument have different namespace for this same object received from first web service “RegisterData” method.
I would like to create first web service and second web service client , where I can use this same type object between them.
Thank you very much for help.
I don't believe this is possible with ASMX web services.
WCF does support this, however.
WCF Links:
WCF Developer Center
Beginner's Guide to Windows Communication Foundation
How to: Configure a Service to Reuse Existing Types
Actually, I think I may have misread your question. I though you were trying to share the same types between the client and the server. ASMX cannot do that. However, it appears you are trying to share the same types between two client proxies. You can do that easily using the WSDL.EXE tool.
Consider a schema, DataTypes.xsd, and two WSDL files that import it, ServiceA.wsdl and ServiceB.wsdl. To create the server interfaces, use:
wsdl /serverInterface /n:SharedTypes.Servers /out:Services.cs ServiceA.wsdl ServiceB.wsdl DataTypes.xsd
This will create interfaces which you can implement in order to create your services. These interfaces will both use one set of classes created from DataTypes.xsd. To create the proxy classes, simply use:
wsdl /n:SharedTypes.Proxies /out:Proxies.cs ServiceA.wsdl ServiceB.wsdl DataTypes.xsd
Notice that you do not need the /sharedTypes switch. That has a different purpose. It is for combining types of external services when you need to download the WSDL and any XSD from the service.
I have tried this using an example like yours, ServiceA posting a message into a queue, and a client picking up that message and sending it to ServiceB. It works quite well.
I agree that it is not possible to do this via the VS Web Reference functionality. To meet your requirements you can use the wsdl.exe utility with the /sharetypes switch.
For more information see Web Services Description Language Tool (Wsdl.exe)
I have a WCF web service using wsHttpBinding that I am consuming from a Java client. I generated code from the WSDL using wsimport. The java client appears to be creating the service fine but when I call a method on the service the client just spins.
MyService s = new MyService();
IMyService i = s.getWSHttpBindingIMyService();
returnedValue = i.getSomething(2); // method call
Can a java client communicate with a WCF webservice that is using wsHttpBinding? And what is the best way of doing so?
Any help will be appreciated.
You'll definitely want to use WSIT to help write your client, and it's probably easiest to use the whole Metro stack. Metro contains jaxws-ri, WSIT & JAB in its jars (webservices-rt.jar & webservices-api.jar).
A few steps to get you started:
Does the published WSDL of the WCF service contain a WS-Policy section? If not, get that info & place it into your local local copy of the the service WSDL file. Re-run wsimport on the WSDL containing the WS-Policy section.
Include the metro jars on your client's classpath.
Write a file named wsit-client.xml file & place it into WEB-INF/classes (or on your classpath). Here's a sample. Now, when you use the client, you should see an INFO message in your console that says: WSP5018: Loaded WSIT configuration from file:
If you get stuck on WS-Policy or wsit-client.xml, use Netbeans. I use Eclipse for development, and while I don't really like Netbeans, I've used it as a reference a number of times, because it has configuration settings in the IDE that will enable you to secure web services & write a web service client that needs security, and it'll generate wsit-client.xml & WSDLs with WS-Policy info in them for you. Try writing a web application in Netbeans & pointing to the service's WSDL to generate a web service client there & see what the resulting files look like.
You can get some questions answered here on SO, but the java.net Metro forum is also pretty active, and you can get good support there as well. Just be prepared for answers like "do XYZ in Netbeans/Glassfish".
Probably this would help: WCF service & Java client
I am trying to use a SOAP Web Service provided by a third party. I am having trouble getting the service to work correctly in .NET 3.5. I have added it as a web reference and all seems to go well. Problem is when I call the service all I get returned is a NULL object. I have worked with the provider and there service appears to be working correctly. He did mention:
"We are using Axis2 Document/Literal and support SOAP 1 and 2."
I am not exactly sure what that means as I am a semi-newbie to using Web Services. Do I need to change some configuration parameters or something in .NET to get this service to work correctly?
From my experience, web service interoperability isn't the magic it claims to be. Especially, between .NET and Java.
Axis2 is a Java web service "engine"
Document/Literal is a style of writing a WSDL that results in a special SOAP appearance
SOAP 1 and 2 (you probably know) the message format and specific versions thereof
all I get returned is a NULL object
Is not much to start with, could you provide more information?
I would recommend, that you try to intercept the exchanged SOAP messages (you can use tcpmon) and check if they are valid. You would probably get an exception if the remote service can't handle your request so I guess your client as some trouble parsing the response. Additionally, you can use soapUI to generate example request to see what a valid request should look like.
Doc/lit (and at least SOAP 1) ought to work with WCF, but I'm not sure how the legacy (pre-.NET 3.0) web service client deals with that.
Did you, in Visual Studio, add a web reference or a service reference? If you added a web reference, you are not using WCF, which may be the reason it's not working. If this is the case, you should delete the web reference and see if adding a service reference instead helps.
It sounds like the proxy that you have generated (via add web reference) is not de-serializing the xml into the type you expect.
As wierob suggests the first thing I would do is trace the messages that you send to the service and the response you receive - that way you can examine the xml you can check that the proxy is creating a suitable request message and see whether the response does contain data that is not being de-serialized into the object you expect
As well as tcpmon you could use fiddler (from microsoft) to trace the traffic or the simplest would be to switch on the message tracing in WCF to log the request and response to files which could then you examined in the service trace viewer tool
With these kind of interoperability issues I find the best thing is to look at the message "on the wire" first - you may then have to tweak the wsdl so that the proxy gets generated correctly or hand craft the proxy yourself
If you post the wsdl and your proxy that might give us a clue as to the issues