|
Home > Archive > BizTalk Server General > December 2004 > BizTalk with Web Services
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 |
BizTalk with Web Services
|
|
|
| Hello,
I'm developping a B2B plateform for my diploma work. I'm trying to use
BizTalk as much as I can. Until now, my platform is running very well
and I really like BizTalk. Now I would like to do is to call a web
Service which should return me a value.
My platform create a XML file. This file should be read by BizTalk,
send to the web service. The web service should return a value which
will be written in an xml file. This xml file should be send with
bizTalk.
I tried to work the same as with an SQL Adapter because everything
works fine with sql adapters.
I created a port with the type of my web service. this port send a
request and receive a response. The problem is that when I use SQL
adapter, a schema for SQL is created automatically. Do I have to
create a schema by myself with a request and a response root? when I
call a web service?
I think I have to create 4 messages :
1 for the schema that comes in
1 for the schema out
1 for the parameters of Web service (base on multi part message)
1 for the response of web service.
I think I have to create 2 map.
Is it right?
Can anyone help me?
Thanks in advance!
Regards
Dens
| |
| Matt Meleski 2004-12-02, 5:48 pm |
| Dens,
Please see the below post on information on how to send XML messages to a
Web Service
via BizTalk. If you want to receive an XML message back, you can
just extrapolate the example and put in return parameters for the WS
http://objectsharp.com/Blogs/matt/a.../10/30/989.aspx
For your question to -> do I have to create a Schema in Biztalk , the answer
is yes or no depending on what you are passing back from your WS. If you are
passing back the XML as a string, then yes you would have to create a Schema
on the BizTalk side and then construct the BizTalk Message in the
Orchestration as below:
For example if your Web Method looked like the below:
[WebMethod]
public string GetXMLMessage()
{
// Some code in here to populate a XMLDom
return xmlDom.OuterXML
}
Then if you called this Web Method in your orchestration , you could
place the returned XML string in an Orchestration message that derives from
your schema that you build by hand in your BizTalk project like this :
construct msgOrchestartion
{
varXMLDom.OuterXML = myWebserviceCall.returnvalue
msgOrchestartion = varXMLDom
}
If your Web method looked like this :
[WebMethod]
public Orders GetXMLMessage()
{
}
With the orders class defined as below :
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://PassingXMLToWS.Orders")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://PassingXMLToWS.Orders", IsNullable=false)]
public class Orders
{
[System.Xml.Serialization.XmlElementAttribute("OrderItems",
Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public OrdersOrderItems[] OrderItems;
[System.Xml.Serialization.XmlAttributeAttribute()]
public string OrderId;
[System.Xml.Serialization.XmlAttributeAttribute()]
public string TotalAmount;
}
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://PassingXMLToWS.Orders")]
public class OrdersOrderItems
{
[System.Xml.Serialization.XmlAttributeAttribute()]
public string OrderItemId;
[System.Xml.Serialization.XmlAttributeAttribute()]
public string ItemAmount;
}
Then when you add a Web Reference, there will be a schema created
for you that represents the above class, probably called something like :
Reference.xsd . You can find this schema under the Web Reference hierarchy
in your BizTalk project.
You can then use this Schema (Reference.xsd ) inside of your Orchestration,
just like any other schema. When you receive back the response from the
above web method, it would populate a Web Message type.
Please also see:
http://msdn.microsoft.com/library/d...amples_yjlm.asp
Matt
"Dens" wrote:
> Hello,
>
> I'm developping a B2B plateform for my diploma work. I'm trying to use
> BizTalk as much as I can. Until now, my platform is running very well
> and I really like BizTalk. Now I would like to do is to call a web
> Service which should return me a value.
> My platform create a XML file. This file should be read by BizTalk,
> send to the web service. The web service should return a value which
> will be written in an xml file. This xml file should be send with
> bizTalk.
> I tried to work the same as with an SQL Adapter because everything
> works fine with sql adapters.
> I created a port with the type of my web service. this port send a
> request and receive a response. The problem is that when I use SQL
> adapter, a schema for SQL is created automatically. Do I have to
> create a schema by myself with a request and a response root? when I
> call a web service?
> I think I have to create 4 messages :
> 1 for the schema that comes in
> 1 for the schema out
> 1 for the parameters of Web service (base on multi part message)
> 1 for the response of web service.
> I think I have to create 2 map.
> Is it right?
>
>
> Can anyone help me?
>
> Thanks in advance!
>
> Regards
> Dens
>
|
|
|
|
|