WCF Test Client that allows me to view/edit the request XML - c#

From time to time we need to test why a certain request coming from our MQ to a WCF service failed. I need to be able to debug the service and find out where it went wrong and resolve the issue. The only information i have is the XML request that was sent to the service. Before we moved to WCF i used a custom tool to send the request to my ASMX debug instance but since we moved to WCF I dont seem to have that option. All the clients i have tried only allow you to fill in the fields through a UI and this is not an option when dealing with huge requests.
Is there a free or open source client that will allow me to do this? I have searched and tried loads but none seem to do it.
Alternatively is there a tutorial or article on writing a test client of this kind? Again i have searched but there seems to be a lack of information on WCF clients and a huge amount on the services.
tl;dr; Im looking for a WCF test client that will allow me to paste in an XML request and send it to a WCF service or a tutorial that will start me in the right direction.

Of course it is not free, but one of our teams is using Altova XMLSpy for that purpose and it works fine.
You can also check (Not sure they will allow you to edit SOAP, but have a try):
SoapUI
WCF Storm
Also check Web Service Studio 2.0 I have tried it will allow you to edit requests.

Not sure I totally understand what you're looking for:
to see the MSMQ messages, you should open the MMC snapin for MSMQ administration on your server where the MSMQ queues live - is that what you're looking for?
in order to create and send out arbitrary XML messages, have a look at SoapUI which is available in a free (and already very capable) version, or alternatively look at SoapBits

Related

Sending data via WCF

I was wondering how you can send data from the client to the host. Currently I have 2 projects and one WCF library. One of the projects is a pump which is the client and I want it to be able to send data to the host? Although I may have a misunderstanding of how WCF works. I was wondering if anyone could point me in the right direction. The problem requires me to use WCF. I want to be able to pass a list of strings to the host.
WCF can send data over many different transport protocols like MSMQ and http. It also enables message security, distributed transactions and other more complex features of a distributed system.
You need to create a WCF service, which is available as a template in Visual Studio. The server should be hosted as a stand alone program os as a web application in IIS.
Afterwards you need to create a client, that can communicate with the server.
WCF is however a large and complicated framework and you should not expect to be able to just scratch the surface and build a system. You need some googling and could possibly start with MS own tutorials.
If you need real useful answers you should be more specific about your program and the client and server operations as well as the deployment scenario.
As faester already said, WCF is a large framework and you can not make a good application by just copy-pasting the code into your project.
You should really read into the matter and then create your programming masterpiece.
faester gave you a link, but it's for basic WCF client-server communication.
Here are some good links on sending and receiving data via WCF:
Data transfer and architectural overwiev
Using the Message class
For a simpler, task-oriented view of how to send and receive data, see:
Specifying Data Transfer in Service Contracts
I hope that this will help you and the people yet to come to this question.

How to debug soap web services?

If I have a server sitting somewhere that is not returning the correct information to a client that uses async methods to communicate with it, how do I debug this with soap?
I mean, atleast with rest I can just type in a web address inside a browser and see on the screen the xml response. But how is debugging usually done with soap?
Note, my client is c#/wpf and the server is java
Have look at soapUI. I usually use it to develop and debug soap based web services.
As already mentioned soapUI is great tool if you want to test communication manually. If you want to see what exactly happens between your application and the service use Fiddler.

WCF communication with java web service

Background
I'm primarily a .Net developer with limited experience in Java. I have a WCF web service that needs to communicate with a 3rd party Message Queue Server in order to send and receive files. The 3rd party has provided a Java API in order to access their Message Queue Server.
I've done some research into the best way to move forward and now I'd like to get some feedback from anyone with experience with a similar situation.
After some digging I determined that one option is to create a java web service in Eclipse and host it on Glassfish. This java webservice would reference:
The java api provided by the 3rd party thus allowing the 3rd party to send the xml files to us.
My existing WCF service in order to pass along the xml to be processed.
So the incoming xml file would flow as follows:
3rd party -> Java WS -> WCF WS
This incoming flow is only half the equation since my WCF web service can also initiate communiation with the third party. So I need an outgoing flow as well.
One option would be to reference the Java WS from my WCF service. However then the 2 web services would each be referencing each other. Is this considered a circular reference (bad practice) when 2 web services reference one another?
If option 1. is considered bad practice, my other option would be to have one of the web services poll the other service.
Other options?
Summary Questions
1. Any insight into the circular web reference question above?
2. Am I on the right track in general?
3. Any suggestions or personal experience you can provide?
Your insight is very much appreciated.
My first thought would be that if it's a quick RPC type call, provided you're calling a different web services for the The call back, I wouldn't be too concerned about a circular reference. Technically you're sending messages "by contract" So as a good practice put your contract definitions in a different project to your service implementation.
If the .NET processing takes a bit of time it may be worth it to use a message queue and a worker service as well.
The other consideration is to find out what MQ infrastructure they're actually using. You may be able to avoid the web services altogether as there are .NET connectors for a lot of MQ providers, like
MSMQ (obviously)
ActiveMQ http://activemq.apache.org/nms/
& WebSphere MQ http://www.redbooks.ibm.com/abstracts/sg247012.html
Just to name a few. There are also MSMQ bridges.

Trouble with SOAP Web Service

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

How to see SOAP data my client application sends?

I have a project where I have created web service proxy classes with wsdl.exe and then simply create an instance of that class (inherits System.Web.Services.Protocols.SoapHttpClientProtocol) and call the method that should send a SOAP message. I'm using Visual Studio 2008 if that matters. And I'm trying this in my development machine without access to actual web service that is located inside of customer's intranet. So, the sending will of course not succeed and I will not get any response back but all I would like to see is the exact content of SOAP messages this solution creates and tries to send. How do I see that?
Use fiddler.
Have a look at SOAPUI from eviware.com.
Its a free for personal use Java app. Among other things you can
set it up to run as a dummy test server. Just load up hte WSDL
and enter the dummy data.
In test server mode it will log your requests so you can see whats happening
inside the request message.
If you're Web service is accessed by clear text, non-SSL HTTP, you can just use a sniffer, like Wireshark, to see the data coming from and to your application. Wireshark can trace, filter and analyze wire data. I have used it do debug HTTP and other protocols many times, and it's a great tool to do this.
SOAP messages are simply XML data sent using the HTTP POST method. So you can for example install a local web server on your development machine, configure your web service to use some dummy URI on this server, and grab the network traffic with WireShark (AKA ethereal). The big advantage of this method is that it involves no coding.
Alternatively you can use an HTTP echo server that dumps its incoming traffic, like this one (found while googling "http echo server"):
You can intercept the call with tcpMon

Categories