SOAP with Attachment Client in .NET - wcf

I'm attempting to build a C# SOAP client which uses SOAP with Attachment. From what I've read, my understanding is that WCF does not have an out-of-the-box solution for this.
Does this mean that the proxy generated from the server's WSDL via svcutil.exe won't be of use to me?

Related

Consuming wsdl soap service with servicestack

I have been trying to consume wsdl soap service with asp.net C# mvc5 application. The original service is written in php which should ideally not matter but I have not been able to make this work. I have just learnt that servicestack is an alternative that works well with mvc architecture. I am looking for pointers on how to consume wsdl soap service with servicestack any help on this will be appreciated. I am happy to buy books that will guide me on how to any of these two methods will work with my mvc application
ServiceStack allows your .NET Services to be exposed via SOAP endpoints by automatically generating WSDL's and XSD's for SOAP Compatible Services which can be consumed with either the generated client proxy created with VS .NET's Add Service Reference or with ServiceStack's .NET Soap11ServiceClient and Soap12ServiceClient.
But ServiceStack doesn't provide a general purpose SOAP client for consuming any 3rd party SOAP Services. SOAP's an unnecessarily complex and brittle format where your best option is to ask the developers of the PHP SOAP Service if they can recommend any .NET SOAP clients since it's unlikely any independent SOAP client implementations will be interoperable without issues unless they've been tested and verified as compatible.
Failing that the most reliable option is to treat the SOAP XML as a string where you construct a raw SOAP Request and POST it to the remote endpoint, e.g SOAP 1.1 Request:
var soapRequest = #"<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>"
+ requestXml
+ "</soap:Body></soap:Envelope>";
Example POST'ing XML using HTTP Utils:
var soapResponseXml = soapEndpointUrl.PostXmlToUrl(soapRequest,
httpReq => httpReq.Headers["SOAPAction"] = requestName);
Then parse the SOAP Response with WCF's Message.CreateMessage(), if even WCF generic Message doesn't support the SOAP Response you can try to parse it dynamically as XML using something like XLINQ's XDocument.

Consuming WCF service (without metadata) on a non-.net platform

I have created a WCF service and hosted it through self hosting. This service doesn't have any metada published.
First Question
Can I consume it through Visual Studio, Add Service Reference? Hopefully not.
Can I consume it by creating manual proxy, i.e. ChannelFactory<ServiceContract>....?Hopefully yes.
Now in the second scenario, the client must be .Net, right?
So it implies that, to consume a wcf service on a non-.net platform, we have to expose its metadata?
Can't a WCF service without metadata, consume by Ajax client, or say Java client??
There are 3 options to consume a WCF Service:
If the service exposes a WSDL use "add service reference" from VS (or an equivalent from another platform). Note that if you do not want to expose the WSDL you could expose it just temporarly, save the WSDL in a file, and then send it to user in any platform to generate proxy from it. You can turn off the WSDL immediately after you save it. Also note that even if the WSDL is not exposed still you need to protect the web service from unauthorized access.
If this is a .Net client it can compile with the same Service Contract assembly and use ChannelFactory etc.
Any platform can send raw soap message (e.g. XML) to the service. Of course they need to know what is the right format. A WSDL can help but even without it if they have a working sample they can imitate it.
WCF provides REST (Representational State Transfer) support to consume it by non .NET client like JavaScript (AJAX), java, Objective C, web browser, etc...
Basically WCF REST is exposes methods and transferring data over the HTTP protocol and it supports all HTTP operations (GET, POST, PUT, and DELETE). This feature is making it platform independent as well as it doesn’t require metadata exposed.
Please refere below links to get more about WCF REST:
An Introduction To RESTful Services With WCF
WCF REST Programming Model Overview
WCF Rest vs. WCF SOAP
Create RESTful WCF Service API: Step By Step Guide

Microsoft WCF - SOAP messaging protocol

is that correct that the default Web Service created using WCF will have WSDL but the message transmission required should not have SOAP tags like
<soap:envelope>, <soap:header>, <soap:body> ?
Are they still using SOAP 1.1 in this case then?
And then, how can I create another web service using JAX-WS that is following this standard?
Thanks a bunch,
Robert
It's not clear to me what you're asking but if you're trying to invoke java based services (Apache, Metro, etc...) with a WCF client, take a look at the WCF Express Interop bindings.

Generate WSDL web-service objects in SAP

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?

SOAP not getting encoded as MTOM in a WCF client

I am connecting to a DFS(Documentum Foundation Services) instance from a WCF client.
I am using basicHttpBinding and I have set the messageEncoding="Mtom". However, when I inspect the soap, I see the document within the SOAP envelop. The document part in the SOAP is about 1.33 times the actual doc size. So the message is getting Base64 encoded.
Do I have more settings to change on the WCF side Or is there a MTOM setting that is not enabled on the DFS side?
Does wsoma:OptimizedMimeSerialization have to be there in the WSDL?
Thanks
http://www.w3.org/Submission/WS-MTOMPolicy/
I guess, my question is: does the Java web service WSDL has to have this wsoma:OptimizedMimeSerialization element, otherwise it implies that the web service does not support MTOM?
Which also implies that if the Java based web service did support MTOM and then if I add a service reference using the WSDL, Visual Studio should automatically create the appropiate binding with messageEncoding="Mtom"??