BizTalk Server General - How to send String to Webservice

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > April 2004 > How to send String to Webservice





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How to send String to Webservice
Alan

2004-04-22, 11:43 am

TIA for your time. I am receiving an XML file into a folder. I need to send this XML file to a WebService (No schema) as one big string. I have the orchestration setup so the file comes in and the message is sent to the construct message shape and I try y
o assign it to the message for the webservice. I can't seem to do this. What am I missing? My assignment syntax is as follows. Any suggestions would be greatly appreciated. I am new to BizT so its a little rough right now!


WebServiceRequest.InBoundXML = CntyDispo(*);
cannot implicitly convert type '*' to "System.String"

CntyDispo is message which is the XML string coming in from a file. All I want to do is send the plain XML string to the webservice without having to assign individual values. How should I do this? TIA

Christof

2004-04-22, 3:37 pm

Alan, I'm sorry but it is not clear to me what your setup exactly is like.
Could you answer following questions please?
- what do you mean with 'no schema'? I assume your webservice does expose a
WSDL, does it?
- do you mean that the body of the SOAP request will be just 1 single
element that contains text perhaps?
- does the XML you receive from a folder have a schema? did you deploy
this? what pipeline do you use?
- what is the type of the incoming message inside your orchestration please?
Do you use "System.Xml.XmlDocument"?
- what is "WebServiceRequest.InBoundXML" please? is the "InBoundXML" a
promoted property or a distinguished field please? I assume that
"WebServiceRequest" is your outbound message that you try to construct?

following syntax is used with message context:
messagename(nameofcontext)
messagename(*) (for copying of all context at once)

so your syntax tries to assign context, not content - that may be your
problem.

Assuming (As I mentioned before, I'm not sure what your setup is like.) that
you used a deployed schema to validate your incoming XML file-message, you
may do following:
- call a .NET component that serialises the XML to a plain vanilla string
- use that string in same component to construct an XLangMessage object,
which you can return from that function
- assign the returned XLangMessage object to the destination message in your
assign expression

There may be simpler ways to do this. Any feedback really welcome.
Kind regards,
Christof


"Alan" <anonymous@discussions.microsoft.com> wrote in message
news:AEAA201C-3650-42A1-8F3B-ED8E343ECAD1@microsoft.com...
> TIA for your time. I am receiving an XML file into a folder. I need to

send this XML file to a WebService (No schema) as one big string. I have the
orchestration setup so the file comes in and the message is sent to the
construct message shape and I try yo assign it to the message for the
webservice. I can't seem to do this. What am I missing? My assignment syntax
is as follows. Any suggestions would be greatly appreciated. I am new to
BizT so its a little rough right now!
>
>
> WebServiceRequest.InBoundXML = CntyDispo(*);
> cannot implicitly convert type '*' to "System.String"
>
> CntyDispo is message which is the XML string coming in from a file. All I

want to do is send the plain XML string to the webservice without having to
assign individual values. How should I do this? TIA
>



Alan

2004-04-22, 4:38 pm

Thank you for your reply Christof. What I am trying to do is -

Incoming flat file is received into a folder and received into the orchestration as a flat file.

It is converted to an XML file. This step is achieved using a custom created pipeline that uses the file dis-assemble to convert to XML.

I want to be able to pass that XML file to a webservice as a string. I believe that strings are best to send to webservices for enhanced interoperability.

The webservice request will be a string containing XML. The webservice will return a string containing receipt acknowledgement XML.


WebServiceRequest.InboundXML is the name of the parameter to be passed to the webservice. Yes the WSDL is defined. A String is to be passed to and received from the webservice.

Thank you.

Alan.


----- Christof wrote: -----

Alan, I'm sorry but it is not clear to me what your setup exactly is like.
Could you answer following questions please?
- what do you mean with 'no schema'? I assume your webservice does expose a
WSDL, does it?
- do you mean that the body of the SOAP request will be just 1 single
element that contains text perhaps?
- does the XML you receive from a folder have a schema? did you deploy
this? what pipeline do you use?
- what is the type of the incoming message inside your orchestration please?
Do you use "System.Xml.XmlDocument"?
- what is "WebServiceRequest.InBoundXML" please? is the "InBoundXML" a
promoted property or a distinguished field please? I assume that
"WebServiceRequest" is your outbound message that you try to construct?

following syntax is used with message context:
messagename(nameofcontext)
messagename(*) (for copying of all context at once)

so your syntax tries to assign context, not content - that may be your
problem.

Assuming (As I mentioned before, I'm not sure what your setup is like.) that
you used a deployed schema to validate your incoming XML file-message, you
may do following:
- call a .NET component that serialises the XML to a plain vanilla string
- use that string in same component to construct an XLangMessage object,
which you can return from that function
- assign the returned XLangMessage object to the destination message in your
assign expression

There may be simpler ways to do this. Any feedback really welcome.
Kind regards,
Christof


"Alan" <anonymous@discussions.microsoft.com> wrote in message
news:AEAA201C-3650-42A1-8F3B-ED8E343ECAD1@microsoft.com...
> TIA for your time. I am receiving an XML file into a folder. I need to

send this XML file to a WebService (No schema) as one big string. I have the
orchestration setup so the file comes in and the message is sent to the
construct message shape and I try yo assign it to the message for the
webservice. I can't seem to do this. What am I missing? My assignment syntax
is as follows. Any suggestions would be greatly appreciated. I am new to
BizT so its a little rough right now!
> cannot implicitly convert type '*' to "System.String"
want to do is send the plain XML string to the webservice without having to
assign individual values. How should I do this? TIA[vbcol=seagreen]
>

Christof

2004-04-22, 5:37 pm

I tend to disgree with the statement you make here...
"strings are best to send to webservices for enhanced interoperability" ?
I really believe that WSDL gives you the power of being able to create an
interoperable strongly typed service contract, understood by each and every
WS compatible product! You should make use of this as much as you can.
When doing this, BizTalk Server will provide you with a tremendous amount of
support, believe me!

Things like BAM, routing, validation and business rules *ALL* rely on
knowledge about the message format, which is exactly what the WSDL's schema
collection provides you.

In fact, this is an interesting discussion... Is redesigning an option for
you?
Please let me know on which items you do not agree.

Kind regards,
Christof


"Alan" <anonymous@discussions.microsoft.com> wrote in message
news:9032A99F-7888-48B0-B9BC-3F0599EA70FA@microsoft.com...
> Thank you for your reply Christof. What I am trying to do is -
>
> Incoming flat file is received into a folder and received into the

orchestration as a flat file.
>
> It is converted to an XML file. This step is achieved using a custom

created pipeline that uses the file dis-assemble to convert to XML.
>
> I want to be able to pass that XML file to a webservice as a string. I

believe that strings are best to send to webservices for enhanced
interoperability.
>
> The webservice request will be a string containing XML. The webservice

will return a string containing receipt acknowledgement XML.
>
>
> WebServiceRequest.InboundXML is the name of the parameter to be passed to

the webservice. Yes the WSDL is defined. A String is to be passed to and
received from the webservice.
>
> Thank you.
>
> Alan.
>
>
> ----- Christof wrote: -----
>
> Alan, I'm sorry but it is not clear to me what your setup exactly is

like.
> Could you answer following questions please?
> - what do you mean with 'no schema'? I assume your webservice does

expose a
> WSDL, does it?
> - do you mean that the body of the SOAP request will be just 1 single
> element that contains text perhaps?
> - does the XML you receive from a folder have a schema? did you

deploy
> this? what pipeline do you use?
> - what is the type of the incoming message inside your orchestration

please?
> Do you use "System.Xml.XmlDocument"?
> - what is "WebServiceRequest.InBoundXML" please? is the "InBoundXML"

a
> promoted property or a distinguished field please? I assume that
> "WebServiceRequest" is your outbound message that you try to

construct?
>
> following syntax is used with message context:
> messagename(nameofcontext)
> messagename(*) (for copying of all context at once)
>
> so your syntax tries to assign context, not content - that may be

your
> problem.
>
> Assuming (As I mentioned before, I'm not sure what your setup is

like.) that
> you used a deployed schema to validate your incoming XML

file-message, you
> may do following:
> - call a .NET component that serialises the XML to a plain vanilla

string
> - use that string in same component to construct an XLangMessage

object,
> which you can return from that function
> - assign the returned XLangMessage object to the destination message

in your
> assign expression
>
> There may be simpler ways to do this. Any feedback really welcome.
> Kind regards,
> Christof
>
>
> "Alan" <anonymous@discussions.microsoft.com> wrote in message
> news:AEAA201C-3650-42A1-8F3B-ED8E343ECAD1@microsoft.com...
to[vbcol=seagreen]
> send this XML file to a WebService (No schema) as one big string. I

have the
> orchestration setup so the file comes in and the message is sent to

the
> construct message shape and I try yo assign it to the message for the
> webservice. I can't seem to do this. What am I missing? My assignment

syntax
> is as follows. Any suggestions would be greatly appreciated. I am new

to
> BizT so its a little rough right now!
file. All I[vbcol=seagreen]
> want to do is send the plain XML string to the webservice without

having to[vbcol=seagreen]
> assign individual values. How should I do this? TIA


Matt Milner

2004-04-22, 11:35 pm

While I agree with Christof completely, if you are determined to do it your
way, try this:

myXmlDom = CntyDispo;
myStringVar = myXmlDom.OuterXml;

Declare your dom variable in the orchestration. You can do the opposite by
loading an xmldom with the xml string you get back and setting a message
equal to that xmldom (in a message assignment).

Getting back to my first point, the message based, well defined interface is
really the best way to go. If you want to remain flexible, add this
flexibilty into your messages with some Any attributes or elements.

Matt


"Christof" <bts2004communityfeedback (at) hotmail (dot) com> wrote in
message news:O8n4dxKKEHA.1156@TK2MSFTNGP09.phx.gbl...
> I tend to disgree with the statement you make here...
> "strings are best to send to webservices for enhanced interoperability" ?
> I really believe that WSDL gives you the power of being able to create an
> interoperable strongly typed service contract, understood by each and

every
> WS compatible product! You should make use of this as much as you can.
> When doing this, BizTalk Server will provide you with a tremendous amount

of
> support, believe me!
>
> Things like BAM, routing, validation and business rules *ALL* rely on
> knowledge about the message format, which is exactly what the WSDL's

schema
> collection provides you.
>
> In fact, this is an interesting discussion... Is redesigning an option

for
> you?
> Please let me know on which items you do not agree.
>
> Kind regards,
> Christof
>
>
> "Alan" <anonymous@discussions.microsoft.com> wrote in message
> news:9032A99F-7888-48B0-B9BC-3F0599EA70FA@microsoft.com...
> orchestration as a flat file.
> created pipeline that uses the file dis-assemble to convert to XML.
> believe that strings are best to send to webservices for enhanced
> interoperability.
> will return a string containing receipt acknowledgement XML.
to[vbcol=seagreen]
> the webservice. Yes the WSDL is defined. A String is to be passed to and
> received from the webservice.
is[vbcol=seagreen]
> like.
> expose a
single[vbcol=seagreen]
> deploy
orchestration[vbcol=seagreen]
> please?
"InBoundXML"[vbcol=seagreen]
> a
> construct?
> your
> like.) that
> file-message, you
> string
> object,
message[vbcol=seagreen]
> in your
need[vbcol=seagreen]
> to
> have the
> the
the[vbcol=seagreen]
assignment[vbcol=seagreen]
> syntax
new[vbcol=seagreen]
> to
> file. All I
> having to
>
>



Robert Gimeno

2004-04-23, 8:36 am

I agree that strongly typing services is going to give the best results but in some areas there seems to be a lack of support and I can see why sending simple strings is attractive (in fact I did do this in a previous Web Services project). For example I
seem to be having great trouble getting BizTalk to consume or expose the following message as Web Services:

<xs:element name ="CustList"><xs:complexType><xs:sequence><xs:element minOccours="0" maxOccurs="unbounded">
name="Cust"><xs:complexType><xs:sequence><xs:element minOccurs="1" maxOccurs="1"
name="Name" type="xs:string" /><xs:element name="Address"><xs:complexType><xs:sequence><xs:element minOccurs="0" maxOccurs="10"
name="AddressLine" type="xs:string" /></xs:sequence></xs:complexType></xs:element></xs:sequence></xs:complexType></xs:element></xs:sequence></xs:complexType></xs:element></xs:schema>

this message defines a list or customers who each hav a name and an address which is represented as a list of address lines (maximum 10). This a pretty typical example of of the sort of data we need to pass around. How would you suggest BizTalk consume an
d expose this message, I'm not having musc success and any advice is greatly appreciated.
Christof

2004-04-24, 12:34 pm

I'm not sure on this one.
Anyone? Is this related to the lack of array-type support?

Regards,
Christof

"Robert Gimeno" <anonymous@discussions.microsoft.com> wrote in message
news:25C70E5B-1958-4544-A92D-AD21648C31AC@microsoft.com...
> I agree that strongly typing services is going to give the best results

but in some areas there seems to be a lack of support and I can see why
sending simple strings is attractive (in fact I did do this in a previous
Web Services project). For example I seem to be having great trouble getting
BizTalk to consume or expose the following message as Web Services:
>
> <xs:element name ="CustList"><xs:complexType><xs:sequence><xs:element

minOccours="0" maxOccurs="unbounded">
> name="Cust"><xs:complexType><xs:sequence><xs:element

minOccurs="1" maxOccurs="1"
> name="Name" type="xs:string" /><xs:element

name="Address"><xs:complexType><xs:sequence><xs:element minOccurs="0"
maxOccurs="10"
> name="AddressLine"

type="xs:string"
/></xs:sequence></xs:complexType></xs:element></xs:sequence></xs:complexType
></xs:element></xs:sequence></xs:complexType></xs:element></xs:schema>
>
> this message defines a list or customers who each hav a name and an

address which is represented as a list of address lines (maximum 10). This a
pretty typical example of of the sort of data we need to pass around. How
would you suggest BizTalk consume and expose this message, I'm not having
musc success and any advice is greatly appreciated.


Robert Gimeno

2004-04-26, 7:35 am

When BizTalk is trying to consume the message it fails to add arefernce complaining about arrays so you are correct there. However it is possible to expose a web services as an XmlDocument type (i.e. result is <any> ) and then assign this to an instance of
an XSD within BizTalk. This may not be ideal but it seems to work.

Unfortunately where I am really stuck is in exposing a message of this type, I've tried the XmlDocument trick but the call to Invoke in the generated proxy fails and I can't find any documentation abot how Microsoft.BizTalk.WebServices.ServerProxy works.
Now I can see how to do this by putting the whole XML into a string and then unpacking it inside the Web Service proxy and maybe encapsulate this in a custom pipeline (hence my interst in this thread) but this seems a bit clunky so if anyone has a better
idea I'd love to hear it

Regards
Robert Gimeno

----- Christof wrote: -----

I'm not sure on this one.
Anyone? Is this related to the lack of array-type support?

Regards,
Christof

"Robert Gimeno" <anonymous@discussions.microsoft.com> wrote in message
news:25C70E5B-1958-4544-A92D-AD21648C31AC@microsoft.com...
> I agree that strongly typing services is going to give the best results

but in some areas there seems to be a lack of support and I can see why
sending simple strings is attractive (in fact I did do this in a previous
Web Services project). For example I seem to be having great trouble getting
BizTalk to consume or expose the following message as Web Services:
minOccours="0" maxOccurs="unbounded">> name="Cust"><xs:complexType><xs:sequence><xs:element
minOccurs="1" maxOccurs="1"[vbcol=seagreen]
> name="Name" type="xs:string" /><xs:element

name="Address"><xs:complexType><xs:sequence><xs:element minOccurs="0"
maxOccurs="10"
> name="AddressLine"

type="xs:string"
/></xs:sequence></xs:complexType></xs:element></xs:sequence></xs:complexType
></xs:element></xs:sequence></xs:complexType></xs:element></xs:schema>>> this message defines a list or customers who each hav a name and an

address which is represented as a list of address lines (maximum 10). This a
pretty typical example of of the sort of data we need to pass around. How
would you suggest BizTalk consume and expose this message, I'm not having
musc success and any advice is greatly appreciated.



Alan

2004-04-26, 10:35 am

I am passing a string because of a paragraph in the MS whitepaper on interoperability. It is all .net on my end but having to talk to J2EE.
"Deciding on a Data Format
With a Web service interface, the temptation is to use the service interface to return
complex types, allowing the adapters to create proxies of these complex types and
consume them. However, because of the issues of handling XSD-based complex types
in Web services, not all Web services stacks are compatible. Experience shows that
what works for one Web service stack may break another. To solve this problem, you
should look at exchanging only primitive data types, such as strings, integers and so
on. All Web service stacks support these data types, and these provide the greatest
levels of flexibility and client access.
If you use primitive data types and need to return something more complex, like an
order, you have to package the data as a string. The best solution for this is to
populate a string with an XML representation of the data. This XML encoding should
follow an agreed schema."
Thank you all for your great suggestions I will try and get it running today.
Christof

2004-04-26, 2:35 pm

Thx for noting Alan.

"Alan" <anonymous@discussions.microsoft.com> wrote in message
news:75B8CBDD-A94F-432B-B418-B6DC30023D58@microsoft.com...
> I am passing a string because of a paragraph in the MS whitepaper on

interoperability. It is all .net on my end but having to talk to J2EE.
> "Deciding on a Data Format
> With a Web service interface, the temptation is to use the service

interface to return
> complex types, allowing the adapters to create proxies of these complex

types and
> consume them. However, because of the issues of handling XSD-based complex

types
> in Web services, not all Web services stacks are compatible. Experience

shows that
> what works for one Web service stack may break another. To solve this

problem, you
> should look at exchanging only primitive data types, such as strings,

integers and so
> on. All Web service stacks support these data types, and these provide the

greatest
> levels of flexibility and client access.
> If you use primitive data types and need to return something more complex,

like an
> order, you have to package the data as a string. The best solution for

this is to
> populate a string with an XML representation of the data. This XML

encoding should
> follow an agreed schema."
> Thank you all for your great suggestions I will try and get it running

today.


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com