Calling Web Service with primitive types within Orchestration - Can't map request message - biztalk

I'm running into this problem when trying to call a SOAP Web Service from within a Biztalk orchestration.
The Web Service is an abapi exposed by SAP as a SOAP Web Service, and the signature of the web method I want to call is something like this:
Operation(param1 as System.String, param2 as System.String, param3 ArrayOfSomeClass)
When I see the schemas generated I noticed that only 'ArrayOfSomeClass' and 'SomeClass' were generated. But I don't see any schema that represents the whole request.
I also noticed that a web port type was generated, and the request message is represented as a multi-part message. The parts of this message contains all the scalar parameters (param1, param2) and also the array.
I know I can just use the assignment shape and fill the message by code, but this is not what I want because I would like to map another message to the web service request.
Is this possible? Any one had a similar issue?
Thanks in advance!

You observation is correct, schemas won't be generated for simple types and its clearly documented here and explains how you should work with such types.
http://msdn.microsoft.com/en-us/library/aa561724(BTS.20).aspx
XSD will not contain nodes for simple parameter types
When you add a Web reference and the Web method has a parameter that is a simple type, the generated XSD will not contain nodes for that parameter. Instead, the multipart message that is generated will contain a part that is of the simple type. The orchestration should handle this message part appropriately. If it is a part of the request to the Web service, manually assign the value to that part with a message assignment shape. If it is a part of the response from the Web service, manually access that part in an expression shape to see the value.
I didn't get your second point
I would like to map another message to
the web service request.

Related

Accessing workflowArguments in a hosted workflow

We are mixing workflows, a workflow using receive activity's more at the end. But at the start we want to pass in some arguments (not using a receive activity!)
Our workflows are already being created and resumed using a dynamic endpoint with IWorkflowCreation and a class derived from WorkflowHostingEndpoint. In the OnGetCreationContext the creationgContext is filled with WorkflowArguments and the workflow runs. At a later part the receive activity's are creating a bookmark which can be resumed with a message. All seems nice.
But in a xamlx there are no WorkflowArguments, i understand why, except that i want them anyway. I though about an activity in which i can write some code to get the Arguments myself, but i do need some help here.
Or is there another way to pass along the WorkflowArguments into a xamls without using Messaging?
You can't pass arguments into a starting workflow service except through the SOAP message that starts it. But there is nothing preventing you from reading any properties in your workflow service. So it is perfectly fine to do read settings or something similar instead of passing them in at startup.
We have solved this exact situation by creating another WCF service which sits alongside our xamlx service on a slightly different url (e.g. /WorkflowMetadata) and this is where we implement a service method that returns a dictionary of string, type.
In the implementation of this service we simply read the xamlx and determine the arguments.
This is what we use to interrogate a target workflow in an activity designer when creating something like a launch-workflow activity.
Creating an activity will not work as that activity will need an instance in order to run. All you want is some metadata about the xamlx service. And if you are using a WorkflowCreationEndpoint to construct a creation context then you are probably only allowing a dictionary of string, object as the start parameters. Therefore standard metadata will not work. This left us with the only option being to provide another service beside the workflow which serves metadata.
Background here: http://blog.petegoo.com/index.php/2011/09/02/building-an-enterprise-workflow-system-with-wf4/

Calling a web service using URL with complex parameters

I have web services that work fine using SOAP, but today I received a request to call the web services using the URL.
So, instead of consuming the service, they want to call http://servicename/ProductEnq.asmx/ProductEnqByCodeWithLogin?Code=123456789&Username=user&Password=bubbles
I found that the "basic" calls work 100%, i.e. when the params are all strings, like the call above. This method returns a complex type.
Where I get stuck is that I have another method that expects a List of strings as parameter together with some other params.
No matter how I try to get the list to be populated, the page always returns "System.InvalidOperationException: ProductEnqByMultipleCodesWithLogin Web Service method name is not valid."
Please note that this call works 100% when called from my application or WebService Studio.
Any hints on if this is possible, or should I just convince the client to use SOAP?
Thank you.
Jaco

Issue with BizTalk orchestration, generate no error but doesn't do anything

I have BizTalk orchestration where it receives file and send file. I have expression shape calling .net class (method) to read xml file and upload file to SharePoint. My expression shape has the following:
XmlReader.readXml();
It's not passing any parameter nor return any value.
My Xml file gets send to send location and generate no error on window logs. However, it's not uploading file to sharepoint. If I run XmlRead.readXml() by itself, I don't have any problem uploading to sharepoint. How do I know if my .net is calling the method and executing?
OK, first thing. If there are no errors in the applications event log and BizTalk does not suspend throwing an exception then you know that your orchestration is working.
The fact that you are not getting the required behavior from it is not down to any biztalk weirdness.
Can you post the code from your expression shape and then it may be easier to find out what your problem is?
I am a little confused by your post because you say you are calling a .net class from an expression shape, but then you have a call to XmlReader in your expression shape. Is XmlReader your own class? If so then you do not seem to be passing any data into your readXml(). This may be why your call does nothing. If you need to pass a biztalk message into a method call from an orchestration you need to use the XLANGMessage type which can be found in the MicroSoft.XLANGs.BaseTypes assembly.
Hope this helps.

Biztalk, need to consume a web service

What I need to do to send a request and to receive answer from the Web Service that I want to consume.
What i have done:
I have done the "add web Reference"
I added a Send Shape and a Receive Shape and a I configured a port that sent and received with web Type, the port binding Specify later and I connect with the Request and response to the Send and Receive shape.
I believe I am missing something ?
From your description I am guessing you might be missing -
A definition of the request and
response messages; you need to
ensure you have a request and
response message defined, with their
types being the generated web types.
Select the correct message for both
the send and receive shape. send
shape uses the request message,
receive shape uses the response
message.
Construct the request message using a construct and a transform or assignment shape before the send shape. the easiest way to get started is to use a map in a transform shape to create the request from whatever message triggered your process, but the exact implementation detail will, of course, depend on your scenario
This should be enough to call the service I would have thought
There are many blog posts on the subject, here's one I found with a quick search that shows all the pieces needed
I'm currently working my way through a project using Biztalk to consume a web service. I think you may have a error when compiling similar to :
"Use of unreconstructed message"
If this is the problem, add a construct message shape to the orchestration before the send to the web service port.
I'm stuck with creating the message syntax but this should get you moving.

How do I retrieve version information from a WCF Web Service?

I want to log the assembly version information into a log file each time my WCF web service is called. I know that in an application the My object has an Application object which has the Info structure, that contains the Version string that I can use. How can I get the version information for the WCF service to a log?
You will need to create either a separate service method GetServiceVersionInfo() that you can call when needed, or you could include the service's version info in some headers that travel along with the message.
If you want to add header to each and every message, the best way to go is create an extension called a MessageInspector. This is a small chunk of code that intercepts every message (in your case: every message going out of the server) and adds some header (or manipulates the actual message).
Read up on Message inspectors in this blog post showing how to write a message inspector, or read the MSDN docs on the topic to get started.

Resources