How do I programmatically create an EndPoint for use with an HttpWebRequest in a Cmdlet? [closed]

StackOverflow https://stackoverflow.com/questions/20750576

Domanda

Keep in mind folks, the proxy/client WCF classes generated by SvcUtil.exe and/or Add Service Reference do NOT always work. Thus you have to do things 'by hand' / 'the hard way'.

Just say'en.

In fact, this is a problem I'm having. I have to talk to a web service written in Java and the WSDL it spits out is so .. fraked up, that generated code simply doesn't work. SO, I have to make the SOAP calls by using HttpWebRequest. This is no problem when you can at least have an app.config within which to set up the end point info.

Naturally, in my case, I'm now trying to talk to this POS Java service within a Cmdlet, which means it's in a DLL and thus can't use an app.config.

So, the question now is; how the heck do I programmatically create / use BasicHttpBinding and EndPointAddress objects (and are those even the right one's) with an HttpWebRequest?

È stato utile?

Soluzione

I agree with you that, consuming JAVA webservice in .NET is a bit nasty especially with the faultcontracts, ReplyAction & the signature coming up with extra wrappers (like type).

The approach I took for a similar need, was by manually rewriting the reference class generated by svcutil.

If the alternative now is to invoke the Java service using HttpWebRequest, then why do we need the Bindings? Assuming, this Java Service is over http, can it not be invoked directly using post/get?

Please could you post more details.

@EDIT: Also, please refer to Consume Web Service with POST from a WCF Service

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top