How to consume xml from WCF in biztalk? - biztalk

My WCF service gives message in XML format and I want to parse that XML to map it into the destination schema.
WCF exposed method (let' say GetXml()) which gives collection of records (let's say Name, Phone records) in XML format. I want to further map that XML records to map to destination schema.
Please guide me as I am new to biztalk.

Have you added a servicereference to consume wcf service using addServiceReference option. That will give you required schemas and binding to consume wcf service.

Related

Issue with BizTalk ESB Itinerary Calling Web Service

I have an BizTalk+ESB itinerary with a Itinerary Service to route the data to a web service, using a static resolver.
When I make the request I get this error:
"The document type "http://schemas.xmlsoap.org/soap/envelope/Envelope" does not match any of the given schemas."
I added Envelope.xsd to my itinerary and set the Document schema in the XmlDisassembler
and set the Envelope schema also
I have the itinerary call to the service set up as:
The service is running, and I restart the hosts every time I update the pipeline.
I'm using the schema from http://schemas.xmlsoap.org/soap/envelope/Envelope
I've been checking online and it looks as though I need to modify the schema to include the structure of the incoming message. Is that correct? I assumed that ESB would create the correct message envelope. It looks as though this is not the case.
Anyone have any advice on how I should proceed with this?

Understanding of OData services

This is a question to improve my understanding about OData and the process of OData services. I'm not sure about the process when an OData request is sent to the server from my Fiori app. The app is added to our Fiori Launchpad. When the user wants to create a new target group in the UI, a create request is sent. What happens then in detail? What I thought so far:
OData service checks the data
If the data is valid, a new entry in the database is created (HTTP POST)
If the data is not valid, the OData service sends an error
I'm not sure about what information is delivered by the OData service and what information is delivered directly from the database? Does the OData service work like a adjustor which transfers the messages sent from the database to the application?
I hope you can understand what I'm trying to figure out. Thank you for your time.
it depends how your backend-methods are implemented. Every Entityset usually has one of these Methods:
Get Entity
Get EntitySet
Create
Update
Delete
There are some more I guess, but these are mostly used by developers. You can redefine every single method and implement your own Business Logic in there.
So, let's assume you want to send data from the Frontend to your service and insert the data into a table inside your database. You have to redefine the create method of your entity and implement own logic. This could contain an insert into a database-table. You have to consider, that your oData Service will throw an Error if the types which are sent from the frontend do not match the Entity-Types (i.e. a String into an edm.Time type).
Here you can find all EDM.Types oData could consume and the correct mapping of the types:
https://help.sap.com/saphelp_gateway20sp12/helpdata/en/76/4a837928fa4751ab6e0a50a2a4a56b/frameset.htm
Hope this helps :)

Converted WSDL to WCF Web Service. WCF WSDL does not match original WSDL

I have converted a WSDL to a WCF web service. However, when I run the WCF service and check the WSDL, it does not match the WSDL originally used to create the service. Why?
The original WSDL (CORERule2.2.0.wsdl) and XSD (CORERule2.2.0.xsd) files used to create the WCF web service can be found here.
The WSDL you get from your web service is automatically generated by WCF. You can find a concise explanation about it in the following post: WCF Metadata.
If you didn't change anything in the web service, the generated WSDL should contain the same contract as the one from the original WSDL.
And if you really need to provide the same WSDL back to your clients, then you could supply an external WSDL by using the ExternalMetadataLocation property on the ServiceMetadataBehavior.

How to set/pass WCF Action name to the Biztalk ESB using LoadGen

We have WCF web service defined with 6 Operations with the single endpoint. This service is created by using "BizTalk WCF service publishing wizard". Basically end user will send the message by calling the particular “WCF SOAP ACTION” of the service. BizTalk resolves the itinerary based on the “SOAP ACTION” using BRE resolver.
Now the requirement is to do the load test with above service
To generate load for the service, we are using LoadGen. But we are having technical challenge specifying the WCF Action(operation) name in LoadGen. Do anyone have any idea how can we do this?
FYI., In our implementation, BizTalk ESB resolves the itinerary based on the “WCF Action” using BRE resolver and not with message type. By using message type, we able to resolves the itinerary using BRE resolver. But the requirement is use WCF Action(operation) name and not the message type to resolve the itinerary in BiaTalk ESB, because multiple operation uses same message type but do different action.
Any help would be highly appreciated!
Thanks
Sudhakar
For WCF services LoadGen cannot create a custom action header for the SOAP action. For basic profile binding you may try to use SOAPSection and define SOAPHeader nodes. That would exclude the use of WCFSection. A better option would be to change the WCF service to accept any action [OperationContract(Action="*")]

xml serialization and de-serialization of generic list in C#.net

I am preparing a code structure like the following;
WCF service - all business logic can implement here. All service methods can takes input arguments as string(XML data) and can return string (XML data) or int.
Client Website - ASP>NET web site with entity layer and business logic layer(BAL layer).
Flow is like this:
client Website --->BAL--> (WCF service----> DAL Layer---->Database)
BAL layer consume wcf service
For this purpose, in BAL layer, I want to create a list of entity class and do XML serialization(list to XML format) and pass it to a WCF service methods.other side in WCF service method de-serialization(XML to list).
How do I do this in ASP.NET and WCF?
You don't do that. This seems to be a common misunderstanding for new users of WCF.
You define your DataContracts which contains your data, pass them to your WCF service, and it takes care of serializing/deserializing them.
You do not serialize them to XML before passing them through the service.
WCF will automatically serialize a list for you, but the default collection type it is deserialized to on the client side is an array.
You can change this default collection to a list (or linked list, or anything else available) by right clicking on your service reference in the project for your client application, selecting "Configure Service Reference...", and selecting System.Collections.Generic.List from the collection type drop down menu.
If you are sending a list from a client to the WCF service, it is sufficient to define you Service method's parameter as a list (if it contains simple .NET types), otherwise you need to define a special data contract as per the other answer.

Resources