User login

Connecting 2 .NET WS using WSO2 ESB

Forums :

Hello Everyone,

I am new to WSO2 ESB. I am trying to connect 2 .NET Webservices (WS1 & WS2) using WSO2.

WS1 generates a string and WS2 cosumes it, simple.

So, I want WS1 to talk to the ESB (by creating proxy?) and then the ESB should pass the message to WS2.
I have had some difficulty in defining endpoints using the http uri, but not sure if that is required.

Can anybody please guide me through the list of steps (& details if req) that I need to follow.

Regards,
Deepak

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hi Deepak Hope this will be

Hi Deepak

Hope this will be helpful http://wso2.org/library/3333

Also refer to the samples http://wso2.org/project/esb/java/1.7/docs/ESB_Samples.html#ProxyServices

asankha

Error

Thanks Asankha,

I have a .NET client communicating with the WSO2 StockQuoteService thru a proxy, and it works fine.

However, when I try to communicate b/w 2 .NET Webservices thru a proxy, it is throwing some error. Below are the error details:

On the console:
2008-07-28 11:54:57,368 [10.101.100.46-MCC-DEEPAK] [HttpClientWorker-14] INFO L
ogMediator To: /soap/LoggerProxy.LoggerProxyHttpSoap11Endpoint, WSAction: http:/
/sophos.com/m2/logger/LogInfo, SOAPAction: http://sophos.com/m2/logger/LogInfo,
MessageID: urn:uuid:2F57A868C887B771331217242497844, Direction: request
2008-07-28 11:56:51,766 [10.101.100.46-MCC-DEEPAK] [HttpServerWorker-5] INFO Lo
gMediator To: /soap/LoggerProxy.LoggerProxyHttpSoap11Endpoint,WSAction: http://s
ophos.com/m2/logger/LogInfo,SOAPAction: http://sophos.com/m2/logger/LogInfo,Mess
ageID: urn:uuid:2F57A868C887B771331217242612244,Direction: request,Envelope: <?x
ml version='1.0' encoding='utf-8'?>Sent the data "muttu" to endpoint "malli".
2008-07-28 11:56:51,766 [10.101.100.46-MCC-DEEPAK] [I/O dispatcher 2] WARN Clie
ntHandler Unexpected HTTP status code received : 400 :: Bad Request
2008-07-28 11:56:51,766 [10.101.100.46-MCC-DEEPAK] [I/O dispatcher 2] WARN Clie
ntHandler Received an unexpected response - of unknown content type with status
code : 400 and reason : Bad Request

On the originating webservice's browser:

System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at LoggerProxyService.LoggerProxy.LogInfo(String infoMessage)
at EndpointCommunicatorService.DataToEndpoint(String endpoint, String data)

Can you please help.

Deepak

Deepak

Deepak

System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.

This error is reported by your .Net service as the ESB closed the connection abruptly.. but the reason for the close was since it received an HTTP 400 (error) message from the .Net service: HTTP status code received : 400 :: Bad Request If you set the log mediator level="full" you can see the payload as well, that's sent by the ESB.. and you maybe able to find out why the .Net service refused to reply. You could also use SOAP UI etc to try this.. or even place the TCPMon tool between the ESB and the .Net service and get a trace of the message flow to find out whats wrong.

Can you also place the following before the send operation?

<syn:property name="FORCE_HTTP_1.0" value="true" scope="axis2" />

this will drop down to using HTTP 1.0 instead of 1.1.. and you could see if that helps

asankha

Hello Asankha, Sorry to

Hello Asankha,

Sorry to bother again , am not able to get it right, probably because I am new to the webservices and the soa world?

here is my .net webservice server:

using System;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;

[WebService(Namespace = "http://tempuri.org/hellowebserver/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{
public Service () {

//Uncomment the following line if using designed components
//InitializeComponent();
}

[WebMethod]
public string Hello(string mesg) {
return "Welcome ........ " + mesg + "!!";
}

}

and here is my .net webservice client:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HelloWebClient
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter your name: ");
string str = Console.ReadLine();

HelloProxy.HelloProxy hp = new HelloProxy.HelloProxy();
string respStr = hp.Hello(str);

Console.WriteLine("Got this response from server: {0}", respStr);
}
}
}

I am defining a WSO2 proxy with incoming mesgs specified as anonymous and a Log Mediator with "Full" level.
The outgoing messages again are anonymous with a Send Mediator.
The target endpoint is http://localhost:{portnumber of the server}/HelloWebServer
Transport protocols configured are only HTTP
Publishing URL is http://localhost:{port number of the server}/HelloWebServer/Service.asmx?WSDL

And then I run my client, it goes awry...

The same kind of a setup with the provided java StockQuoteServer and my own .Net client works fine, not sure how. Is there something wrong with the target URL that I am giving for the target .Net webservice? I have appended Service.asmx but it still doesnt work.

Deepak

Hi Deepak Sorry I have no

Hi Deepak

Sorry I have no experience with .Net.. but if the .net service and client works, they should be fine.

Please download TCPMon (http://ws.apache.org/commons/tcpmon/) and start it on some port, and make that forward requests to the .net service port. Now point your client to the TCPMon port, and invoke. You will then get a full trace of the low level message from TCPMon.

Now point the proxy service to the same TCPMon port, and get a second trace. Attach both these traces and we can then help u

asankha

Hi Deepak, I tried your

Hi Deepak,

I tried your service and client. When I ran the service as standalone service (running through visual studio), and send the request through ESB, the service did not understand "Transfer-Encoding: chunked" and full path (path with ip and port) in POST. However, when I deploy the service in IIS, I could be able to send request and receive reply through ESB without any problem. I think you are using stand alone service approach. Can you try to deploy it in IIS and see whether it works?

Also, as Asankha mentioned, it would be very helpful if you could capture the message through tcpmon and send the messages.

Regards,

Shankar

Works with IIS

Hi Shankar,

I have tried with IIS and it works just fine. Many thanks for the help. Not sure why it does not work with ASP.NET.

Anyways, I shall continue with the evaluation and will get back if any doubts.

Thanks once again.

Deepak

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.