Google Search

Google
 

Thursday, July 24, 2008

Video: Sending Attachments with WSE2.0 Web Services

Presenter:Mike Taulty

In this session we'll look at passing file attachments from a web service to a client and vice versa

The following text is a software generated transcript of the video. Click on a minute link to jump to a location within the video


Minute 0

Lad welcome to visit net framework nugget session 1 in a series of short sessions were written by the Cabinet is just looking how you can get stuff done with the net framework minus m Tolkien I work in the developer and platform group in Microsoft in the UK and in this particular session political look at how we can news Web services enhancements all with the 2 0 to move file attachments backwards and forwards men were invoking Web services so let s going to visual studio and much greater web service projects would justify a new project and great web servers call this picture service very much than allowed out of and solution so visual studio to Britain s bits for me and I discovered close down the existing as my father gives me through that from project Avenue on as

Minute 1

Avenue web service in here and will call this again picture serves as a pair so we can get ago fillers before we start writing code because laboratory working with Web services enhancements are with you to we need to go to project and is switched that on effectively so ago do with the settings am we just switch on project working with the two Tories done and Angus is a reference to a new live at a programme against Sweden brain that are lively and he is a Conservative programme against Microsoft and Web services to also the attachments functionality and now he s gone to work methods of us go ahead and take at this boilerplate code and prison code of are so wanted to do a ears will have and method if you like here which try to get as a picture and will take in a filename and this is roughly part of Lex Service

Minute 2

And so what will do it is we will be needed to talk to the soap context and it was he gives us hard off there and then we get hold of that thing were going to get a picture for the caller and we need to prevent they are so complex that that s likely the response so context I can get hold of the current one by just touching the static property here so we can get hold of the soap context in article CTX equals that done that current static property and exact content while to do is get hold of the attachments and adds a new attachment to this takes an attachment to their taken attachment attachment unless once owned one of the others we ve got here is essentially a hour as he threat types what kind of man tightly passing back to also image them jpeg there I will also say that the passive act particular

Minute 3

Is essentially sobered on that path on the filename that the user gives us go to have done that and we ve put that into the attachments going back from a service just make sure that we can compile this currency was built that very quickly and that s okay to like their switch to think about consuming this thing if we go back to our solution here I already have a very simple application it is the Windows forms application where I perform this kind prepared for full working out with the service to all of who pays we will go and add a reference to the service from this application so little and other reference and will both be going out to local host picture service picture service to smacks asking to the whistle document locally let s call this again picture service at adding analytical rights and go behind this button here to log

Minute 4

To do is bring in the namespace for the Web service reference just added that s just adding picture service here and then when these effects are a lot like to do is make a new instance three picture service at school S fuses are attracting right and radical get picture on that I m going to pass the text that the use of on the screens has attacked what onscreen that we can use a whole complete on the client side here we need to get access was into contact to we also need to enable was if the client program so let s go to the client program here was the second is enable with the battle also reference the right assembly for as you can go and again begin namespace is to programme against that spring in Microsoft or

Minute 5

Services and let s bring you attachment is going to want again we can get hold on firm are so complex they all can be essentially what we ve got here is a proxy S and this is not always a proxy this is just a regular proxy every goal looking RM proxy filed at this point that just he will files in the solution had look at the proxy is it that this is just the regular so victory a proxy as in net version 1 1 without an axe to standard proxy however found that because we generated a proxy before we added that with these settings if we go now and update this product proxy that Cisco update that yes to all on that we should find out is that we ve got to proxies with never a whizzy one and with a regular to begin on programme now against that was you settle back to a code and

Minute 6

Proxy that is no good to me I want a picture service whizzy proxy ago and it eventually create the right thing over here and we do and then when this call is completed we can get back the response so contacts ago we can reach into its attachments won t have allowed just the first attachment in their figures we could haven t another is only one attachment and there very nicely I can get hold of as a stream of data so much grabbing a stream from a stake which allows me to do an image start from string very and create an image to let make an image that s what I image start from string is in the attachment comes back and I have a picture box on formats at the image to the eye to work the day that s feeling to inevitably on the screen of a select and let s try that is if it works but is built that codes if we made any errors should be okay there

Minute 7

To go to my web server and go into their term picture service folder photocopier picture because you have any pictures in here its pictures can frog and let s go and run the application task for Kermit jpeg and see if we can get a picture day and the industry size that you are residing with the and so I felt that all the term is on the screen but you can see that this is an accurate representation of his Cabinet comeback to win as the life battle about server are pretty easily and similarly if he wanted to send files up to the Web service we can go right very similar code so if it had to go back perhaps to our own observers cohere it back to this Web service to the code let s add a second am right method hereis going to have put picture

Minute 8

Didn t be rather a strange matter because we really have any parameters to put at the moment s thought we doing here is getting hold again of this time the requests a context and we can get a picture at this point is assessing what we can do is reach into the attachments again context attachments get the first one again we can get hold of this very whole of that string has really stream is just thorough spring and any to put this somewhere let s change the front is not as if they surprised us a summer to put this thing and added a drop in a piece of her clipboard code here which is eventually going to let me save that streaming to the file system are not necessarily something you really want to do with a web service you could if you wanted to so let s just call writing to file out if the filename and will pass stream that is built that make sure that s okay to six

Minute 9

Lotion are that we got here six occurred at least then I go to got than entice every now go back to the client application lets the fresh sea at the reference that it has of that service because it added an effort to its latest update that I reference and will go to the close of the former and tribal something behind this top button I already have something that uses a file dialogue to get a file selection here is what we will be doing again is the creating an instance of the picture service was the proxy outbidding acid output picture this time around will use dialogue filename sleeping with dialogue filename right oil at a request from that of his path glass would bring in a civilian system IO here to work with that thing to ease the path glass of

Minute 10

Just to get the file name of the selection in the dialog will use that and before we can use pulpit to eat at into the attachment so let s get hold of the requests context but populating attachments that add a new attachment to it since a new attachment is image JPEG and is going to be the dialog firemen saddled passing up their own invoke that Watson s were done in place we can go and run this code and when you click on a button will get a dialogue and a cigarette in my notes folder and find an nice picture of a total that I got here and there to submit that allowed a service I have given low service permission to write the file system is a very bad choice and put my demo here it s fine the listener has to as attachment across there that seemed to work fine let s go and have

Minute 11

Look around different console season file that you were expected to select them to be in my picture service folder and which have a new JPEG in here we do and you can see that the the really rather nice bit of the turtles and that there on the surface so with at soap attaches went backwards and forwards here and there lived to stop debugging it exists through the use of this attachment property a collection on the so complex that we concern from the client to the service and from the service back to the plan it important to say what this is using is there a technology from specification cult of US attachments and you need to go out over a longer look at the US attachments to see whether it suits your purposes if you are in front that was exactly with the sack if Oregon worked great for you if you re going from the witty stacks in the else s site s non Microsoft in a statement around the interoperability of the US attachments and what s happening in

Minute 12

Areas attractions just ensure that it does what you want so why have we seen in this shortsighted or little how don t want WST with a 2 0 supports the UWS attachment specification for moving their attachments that were supposed to from Web services looked at how this manifests itself in whizzy as they are a bunch of properties are available on your soap context in order to send files to a web service and and back from away service at the leading that you see this in the scanner because we worked around as an ex web services here at me can also do this with non as an excellent services so was he has a author doing TCP soap messaging and the same file transfer technology the same attachment stuff works in exactly the same way if you re working in in that cancer questions were to just feel comfortable is that it is not just read your there is there if he wants to the TCP messaging thing to where can you go to get more information about services well

Minute 13

Oliver Best buy some would be an MSDN developer Centre selected his dynasty in the Microsoft com web services all one word there s some great stuff at there in the section on the left and cycled understanding Web services are some really bringing articles equally there to get a good picture of what s going on in this area and if the something is he specifically in this session and is thinking hang on an hours more information on that there feel free to drop me an airline and told it Microsoft com has a seven screen their drop me a line and I ll drop your response other than that I look forward to hearing seeing you next time and thanks relativity

Click here to go to original video page

No comments: