Generate WSDL web-service objects in SAP - wcf

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?

Related

Generate SOAP service in mule using WSDL file

i am trying to create a soap service in mule using a wsdl file. but i am getting following error -
Error generating from WSDL
Could not find velocity template file
org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm
Another thing:
In mule is there any tool to create WSDL file.
Is it necessary in mule that for every WSDL file it will create java classes.
I am facing little difficulties while doing top down(wsdl first) development. Please suggest me if there is any tutorial.
Mule's SOAP web service stack is based on CXF so use the code generator from CXF to generate client classes from each of your WSDLs.
This is described here: http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html
Also note that it's possible to call remote web services without generating client classes but it's very limited (only simple types can be used, no complex ones), see: http://www.mulesoft.org/documentation/display/current/WSDL+Connectors

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

How to get the original service from a wsdl file

i have a wsdl file, now i need to get the original wcf service. and after that i want to use(consume) that service in my web project.
please tell me is this possible? and how?
The WSDL contains only the definitions of the service contracts and data contracts. Don't expect to reconstruct the implementation of the original service from a WSDL file. In order to generate a client proxy which will allow you to call the service given this WSDL you could use the svcutil.exe utility.

Windows Communication Foundation Service Library Project

Do you know if there is any way to access the wsdl file when you create a WCF service library? It seems you can get it when you create a WCF application but not the service library...
Any ideas would be appreciated.
Thanks
The only way to access the WSDL is once you host and run the service. Otherwise, you cannot access it. So, create a host (or application as you are calling it) with a mex binding, then run the service and you should be able to access the WSDL.
Once you do this, you can save the WSDL as a file or something for later reference.
You cannot access the WSDL automatically. Of course if you compile the static WSDL into the service library, as a resource, you could then access it directly.
but what is it that you are trying to accomplish?
The "Service Description" is available inside a service. It is not the WSDL itself, but rather, the in-memory model of a service description. It includes the namespaces, the element names and types - everything in a WSDL, and more.
You can get at it with System.Web.Services.Description.ServiceDescription. Typically this is done within a ServiceHost, a ServiceHostFactory, or an IEndpointBehavior.

WCF Service invoking - without any reference added

I want to invoke a wcf service for testing on the http layer. I do not want to add a service reference and create a proxy and invoke. I want to create a new web test(VSTS) which sends a http request to the service and posts(Http post) the request in http body as an xml.
I have service metadata, with which I can see the datacontracts, but the wsdl:operation has only the operation name, wsdl:input is just blank.
On the Contary, an asmx service will have the soap request in the metadata which can be copied as the http request body, with the parameters replaced.
How to build a wcf service xml body from scratch just by looking at the service metadata (no access to the service logs as well), have got just the end point.
It is something like
<root>
<element1>element1</element1>
<element2>element2</element2>
</root>
But, how to find out this, root has to be some thing like
<FunctionRequest xmlns=""http://schemas...."" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"">
(tested for a local service and worked)
Now, without having access to service logs(svctraceviewer logs), not able to add a service reference, not able to use svcutil.exe(certificate based service), just only with metadata - wsdl, is there a way to find out the request that is to be sent to service?
Well, you will have to create proxy - either statically by adding a service reference or running svcutil on your service metadata, or you can construct it dynamically totally in code, if you wish.
In that case, you'd have to have your service contract (ISomethingService) at hand, and check out the ChannelFactory < ISomethingService > () concept - that should get you started.
Marc
Yes you can, but you have to do a little work first.
Build the service client by running svcutil.exe on the wsdl/xsd metadata. This will generate a c# with your service and data contract objects. Compile that to an assembly using csc.exe.
See the soap envelope body you can create a request object and manually serialize it with data contract serializer. Or you can host the assembly in WcfSvcHost.exe and add wcf logging to the config file. In either case you will only have the correct xml for the body, and even that might be wrong if the real service uses xml serializer instead of data contract serializer.
The next part is the hard part because you need to know the security model for the real service. If it only uses certificates for SSL and server identification, you should be able to send the xml using WebClient. But if it uses mutual certs and/or security tokens, you pretty much have to create a channelfactory by hand with the right bindings.