by community-syndication | May 18, 2009 | BizTalk Community Blogs via Syndication
If you have read some of the previous posts on this blog related to using jQuery in SharePoint 2007 sites, you probably know that it’s perfectly possible to make call the out-of-the-box SharePoint web services by making use of Javascript running in the client’s browser. This opens up a huge stream of possibilities from which I already covered some of them on my blog. A very important piece of information you need if you want to make a call to a web service is of course the URL of the web service. Figuring out this URL seems to be more trivial than it actually is. My first idea was to use the URL of the page in which the call to a web service actually happened; e.g. you’ve got a Site Page accessible in SharePoint using the URL http://mysite/mypage.aspx, so you strip the /mypage.suffix and add /_vti_bin/lists.asmx (if you’d like to call the Lists web service of course). The thing is, this will only work if your mypage.aspx file is setting in the Root Folder of your SharePoint site. For example: when you would put the Site Page in a Document Library instead, the URL of the page would be http://mysite/Shared Documents/mypage.aspx, so you’d have to strip the /Shared Documents/mypage.aspx and replace it with the Web Service suffix. This can get very complicated when you don’t know upfront in what kind of location the page will be stored (a Site Page in the Root Folder or a Document Library, an Application Page in _layouts, …). It’s possible to write a bunch of code to figure that out, or you can make use of the following technique!
A very easy and quick way to get a reference is to make use of the alternate link SharePoint will but by default in the head section of every rendered page:
<html><head>
…
<link type=”text/xml” rel=”alternate” href=”http://weblogs.asp.net/_vti_bin/spsdisco.aspx” />
…
</head>…</html>
The href attribute will always point to a server relative URL of the spsdisco.aspx page; which is located in the same folder as the out-of-the-box SharePoint Web Services (/_vti_bin). Even if you are in a sub site, another site collection, an Application Page, … the link elemen will always be there, and point to the correct URL. So the following piece of Javascript code, will retrieve the prefix you can use to make calls to the correct URL’s of the SharePoint Web Services:
var spsdiscoUrl = $(“head link[rel=’alternate’]:eq(0)”).attr(“href”);
spWSUrlPrefix = spsdiscoUrl.substr(0, spsdiscoUrl.length – 13);
(If you haven’t already noticed: I’m using the jQuery Javascript library.) The first line will get the value of the alternate link in the head of the HTML page; the second line will strip spsdisco.aspx (13 characters). Once you’ve got this prefix, you can use it to construct the URL of the SharePoint Web Services as follows:
$.ajax({
url: spWSUrlPrefix + “lists.asmx”,
type: “POST”,
dataType: “xml”,
data: soapEnvTasks,
complete: processResultTasks,
contentType: “text/xml; charset=\”utf-8\””
});
by community-syndication | May 15, 2009 | BizTalk Community Blogs via Syndication
As everyone knows, there is no shortage of passion in the tech industry. Naturally, there are many viewpoints out there, which leads to another thing I always enjoy.a spirited debate. Just so happens that I’m having one right here as a result of the recent WebSphere Loves Windows campaign and benchmarking results. I’d like to take the time to thank those of you who have responded or posted on the work to date. Remember, this is all in the name of saving customers money and helping them achieve optimal ROI.
While I rely on Greg to answer some of the technical questions associated with his research, and he’s done so via his blog, I also want to continue to emphasize two points:
%u00b7 We stand behind the results and the methods used for this testing from end to end. In fact, I recently responded to IBM by offering to pay for independent benchmarking via a third party. I hope to hear back and get that going, yet my phone remains strangely silent.
%u00b7 Apples to apples comparison? Well, we know that everyone’s apples look a little different, so check out the tool and see for yourself. By doing this you get to run what you deem as the fairest possible comparison and see how it works.
Please keep the feedback coming! We look forward to seeing more results from others as they test new configurations.
by community-syndication | May 15, 2009 | BizTalk Community Blogs via Syndication
This is actually a step by step tutorial on how to enable batching for outbound EDI transactions, where the input file needs to be split up from one single message but creating multiple transactions.
In my case I am going to take an invoice process. I am picking up a file from an FTP site with multiple rows, each row represents an invoice. Once all of the transactions are created, I need to release the batch.
The first think I need to do is create an orchestration that promotes the following context properties:
EDI.ToBeBatched
EDI.DestinationPartyId
EDI.EncodingType
Because I am going to be looping through a single message, I am unable to promote values in a loop, so I need to escape the loop to promote the values.
Create an orchestration that will be called from within the loop to send it to the Microsoft’s batching orchestration. In this case I am going to create a new project called InvoiceBatcher, and the in the project create an orchestration. Add the following references:
C:\Program Files\Microsoft BizTalk Server 2006\Microsoft.BizTalk.Edi.BaseArtifacts.dll
C:\Program Files\Microsoft BizTalk Server 2006\Microsoft.BizTalk.Edi.BatchingOrchestration.dll
Reference the EDI 810 project.
Setup objects and configuration for the orchestration
1. CorrelationType which contains the context properties
EDI.ToBeBatched
EDI.DestinationPartyId
EDI.EncodingType
2. Multi-part Message Type called EDIType representing the 810, also change the Type Modifier to Public (because we are going to be sending data to this orchestration outside of this project
3. EDIPortType which is a one way port type that points to the multi-part message type created in step 2.
4. Create a Correlation Set that is based on the CorrelationType created in step 1.
5. Create a message called OutEDIMsg that is based on the EDIType created in step 2.
6. Create a Port called Port and referencing the EDIPortType that was created in Step 3 and set it to Direct and direction set to Send.
7. Create an Int32 Orchestration Parameter called PartyNo with a direction of In
8. Create a Message Parameter called EDIMsg based on the EDIType created in step 2 with a direction of in.
9. Click on the Orchestration surface and change the Type Modifier to Public so it can be accessed by other orchestrations that will be referencing this assembly
Your orchestration view should look like this:
The orchestration surface should look like this:
The code in the Promote Context is this:
OutEDIMsg=EDIMsg;
OutEDIMsg(EDI.ToBeBatched)=true;
OutEDIMsg(EDI.DestinationPartyId)=PartyNo;
OutEDIMsg(EDI.EncodingType)=0;
On the Send EDI Message, send the OutEDIMsg and make sure that the Initializing Correlation Set is ’CorrelationSet’
Deploy it to the BizTalk EDI Application
Next is to create the batch release process. The first thing we need to do is create a schema that represents the table in the management database.
Create a new project called PAM and create a schema called PAMRequest.xsd. Open the newly created schema in the XML editor, not the BizTalk Schema editor and paste the following code:
<?xml version="1.0"?>
<xs:schema xmlns:tns="http://PAM_Trigger" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://PAM_Trigger" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Request">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:updategram="urn:schemas-microsoft-com:xml-updategram" updategram:Prefix="updg" minOccurs="1" maxOccurs="unbounded" name="sync">
<xs:complexType>
<xs:sequence>
<xs:element updategram:Prefix="updg" minOccurs="0" maxOccurs="unbounded" name="after">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="PAM_Control">
<xs:complexType>
<xs:attribute name="DestinationParty" type="xs:string" />
<xs:attribute name="EdiMessageType" type="xs:short" />
<xs:attribute name="ActionType" type="xs:string" />
<xs:attribute name="ActionDateTime" type="xs:string" />
<xs:attribute name="UsedOnce" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Response">
<xs:complexType>
<xs:sequence>
<xs:element name="Success" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Deploy the project to the BizTalk EDI Application
Now to create an orchestration that will actually release the batch of transactions.
Create a new project called BatchRelease
Add a reference to the PAM assembly.
Create a new orchestration called ReleaseEDIBatch
Set the Type Modifier to Public so any other orchestration can reference it.
Create the following orchestration objects (from bottom to top)
PamResponseType (Multi-part Message Type)
PamRequestType (Multi-part Message Type)
PAMPortType (Request/Response Port Type)
TempXML (System.XML.XMLDocument)
PAMResponseMsg (PAMResponseType)
PAMRequestMsg (PAMRequestType)
PAMPort (Specify Later, Send-Recieve direction)
PartnerNo (Direction:In, Int32)
The Orchestration View should look like this:
The orchestration surface looks like this:
The logic to create the PAM message in the message assignment shape is:
TempXML=new System.Xml.XmlDocument();
TempXML.LoadXml("<ns0:Request xmlns:ns0=\"http://PAM_Trigger\"><ns0:sync><ns0:after><ns0:PAM_Control DestinationParty=\""+System.Convert.ToString(PartnerNo)+"\" EdiMessageType=\"0\" ActionType=\"EdiBatchOverride\" ActionDateTime=\""+System.Convert.ToString(System.DateTime.Now)+"\" UsedOnce=\"0\" /></ns0:after></ns0:sync></ns0:Request>");
PAMRequestMsg.MessagePart=TempXML;
Deploy it to the BizTalk EDI Application
Now to create the actual Invoice orchestration, first reference the InvoiceBatcher and the BatchRelease assemblies. Create the multi-part message that represents the input message, and the port type to bring in the file from the ftp server. I created the following variables all as Int32:
ThisInvoiceNo (default value set at 0)
PartyNumber
InvoiceCount
OriginalInformixMsg (Informix810Type)
NewInformixMsg (Inforix810Type)
EDIMsg (InvoiceBatcher.Multi-part Message Types.EDIType)
InformixPort
The following Orchestration View represents the setup.
The steps for this orchestration is to receive the file, count the number of invoices, set the party number, start looping while the current invoice number is less than the invoice count. In the loop, it increases the current invoice number, injects that number into the message. The map takes that newly created message and extracts the data from the input message and creates the 810 transaction. It then sends the transaction to be batched and continues creating new transactions. Once the loop completes, it releases the batch.
The orchestration looks like this:
The Set Party Number expression shape has the following code:
InvoiceCount=(System.Int32)xpath(OriginalInfomixMsg.MessagePart,"count(//Invoice)");
PartyNumber=1;
The Inject Number message assignment has the following code:
ThisInvoiceNo=ThisInvoiceNo+1;
NewInformixMsg.MessagePart=OriginalInfomixMsg.MessagePart;
xpath(NewInformixMsg.MessagePart,"/File/Value/text()")=System.Convert.ToString(ThisInvoiceNo);
The map looks like this:
The arguments to the Send EDI start orchestration shape (InvoiceBatcher.BatchPromote) are the following:
The arguments to the Release Batch start orchestration shape (BatchRelease.ReleaseEDIBatch) are the following:
The last thing of mention is to set up the send port for the ReleaseEDIBatch orchestration to bind to.
In the BizTalk EDI Application, create a request response send port set it to SQL and point to the BizTalk Management database. Sent the send and receive pipelines to DefaultXML
Set the following connection information as follows:
Bind to it and you are ready to go!
by community-syndication | May 15, 2009 | BizTalk Community Blogs via Syndication
I recently took the plunge and upgraded my 64 bit desktop from Vista to Windows 7 RC and for the most part I’ve been very happy with it. So far the only compatibility issues I’ve had were with some CD / DVD mounting tools and Live Mesh. I quickly realized how much I’ve come to rely on Live Mesh to keep files in synch between my desktop and laptop. All of my presentations and writing that I do live on both machines and I have a Tools folder with small utilities like .NET Reflector, Notepad2, etc. So when Live Mesh kept crashing under Windows 7, I got a little miffed.
I started by trying to set the compatibility to Vista or Vista Service Pack 1, but that didn’t fix the problem. I kept getting errors that the Mesh Operating Environment had stopped working and after closing it, it would restart, only to fail again in a few minutes. So, I did what any self-respecting developer does when they have a problem they can’t fix: I searched the web. Nothing, no love at all. I saw a few things about recent updates, which I’d installed already, and some registry hacks for the Win 7 beta, which were already incorporated into later builds of the product. So finally, I did the only logical thing, I uninstalled Live mesh, logged into Mesh.com and got the installer, and re-installed. A quick reboot, and all seems well. So, for those of you out searching the internet for a fix, hopefully this helps you out.
Of course, this is on My Machine, which is a home built x64 machine with an upgrade from Vista SP 1 to Win 7 RC. With all that in the mix, your mileage will likely vary. ;)
