Apply WSDK- to implement and use DIME Web Services (on)

zhaozj2021-02-17  61

Apply WSDK- Implement and use DIME's Web Services

Mood

2002-10-20

Article Type: in-depth

Difficult Level: 7/9

Version: 1.26

Nowadays, I still remember almost a year ago, I use ASP.NET to make A B simple Web Services. I also remember that the topic of the article is very attractive, what is called "Step by step to start Web SERVICES". That is also one of my very early articles in 9CBS. I don't know that I have been in the past year. When I saw WSDK and wrote this article, I started to miss the previous article.

Today we come to see some interesting applications, which are primarily applied according to Microsoft's latest Web Services Developer (Microsoft Web Services Development Kit Technology Preview Beta) Advanced Applications. Although there are many times compared to applying a year ago, it gives a lot of imagination and development of Web Services. It also indicates the future Microsoft's support and prospects for Web Services. But for any use of technology or developers developed by Web Services, the development of Web Services is still too slow, and each milestone is capable of granulos, one step is one inch. Founded in 2001, WS-I.org, 2002 Web Services's basic development library entered BETA and released, and we might get a formal version at the end of the year. However, the norms and implementations of Web Services security and transactions are still far from.

Perhaps we have enough patience waiting for Web Services to continue to grow, may have five years of 5 years in five years. But there is a little sure, application and learning Web Services can start from today, from now on, in fact, everyone familiar with Web Services has begun to apply Web Services in their projects. Web Services has begun to slowly affect the architecture of our application. When a technique begins to change the programming and programming structure of software development in unknown and invisible, then this technological potential will have a strong vitality. So, Web Services, XML, the DOTNET I like :)

Today, we have to see it very simple, we will use new features in WSDK, implement and use DIME in Web Services. What do you need to know before this is DIME, what is WSDK, some simple ASP.NET Web Services and some simple operations, I guarantee that this time does not use A B as an example.

If you have installed vs.net, then you still need to do it here to download the WSDK development package (these two articles that Microsoft attached to the article, I suggest you have a certain time to see), I know this preview is called GXA, fooled to WSDK, I don't want GXA and DOTNET to have too many products and concepts, thus become unclear. Ah, don't ask me: What is gxa

WSDK's documentation has not been described in what is DIME. It is simple to say that it comes with binary data in SOAP's message, which means you can transfer text and common data types in Web Services, but also pass and receive binary. Sound, image and any binary stuff. SOAP is based on customer / server-side, which means that DIME must be transparent and supported by both.

In WSDK, we can also use ASP.NET to implement DIME, very stupid (later we will see its limitations), the most important thing is no unified specification, for such web services, clients Almost at all or difficult to program it. Below we implements a simple DIME application client / server, and also mention how to use Microsoft SOAP TOOKIT V3 TRACE Utility, my friend often tells me how this stuff doesn't know how to use, there is no Pocketsoap's TcaPtrace, maybe It is a personal habit, but Trace Utility is not necessarily unable to use, and it is very simple. To learn this Trace Utility, you also need Download Microsoft Soap Toolkit 3.0. It seems that we will probably do these three things, generate a web service with DIME, generate a Client consumption. Web Services. Finally, we use Trace to track. Honestly, if you understand DIME and ASP.NET, then you will find a lot of familiar with new settings, not code.

One. Generate web services.

This is relatively simple, mainly some settings, you need to learn how to use WSDK, and learn to set up an increase or additional web service. I remember that you are setting up a registry, now it's different, you need to deal with XML configuration documents.

First of all, we need a new ASP.NET Web Services project, then you need to add WSDK's Reference. Click the item Right click to add a WSDK reference in the dialog box below. As shown below:

Then add the following code in the ASMX code:

USING Microsoft.wsdk.dime;

USING Microsoft.wsdk;

Using system.net;

And confirm if there is use system.web; use system.web.services;

Then we join a method, the code is as follows:

[WebMethod] public void getDotnettoolslog () {WebRequest WebReq = WebRequest.create ("http://localhost/images/webflag.png");

WebResponse WebRES = WebReq.getResponse ();

SOAPCONTEXT RESPCONTEXT = httpsoapcontext.responsecontext;

DimeAttachment Dimeatt = New Dimeattachment ("Image / JPEG", TypeFormatenum.Mediatype, Webres.getResponseStream ());

RespContext.attachments.add (Dimeatt);

}

After that, you can save our projects. It is seen that this code is to return a picture to the client requesting this Web Services method. The settings before running are working:

Find the web.config file of your project in Solution Explorer, double-click Edit mode, then add the following configuration information to the of the file, I suggest you prefer you! The front line of /system.web>.

The Following Section is Required When the Dime Feature of the WSDK is buy.

->

Maybe you will ask these stuff I know, especially publickeyToken, simple, some of you can find all WSDK.config in the WSDK installation directory, all of which you need all about WSDK configuration information and format. Complicated, you can find Microsoft.wsdk in the ASSEMBLY directory of the system installation directory and press the right key to see. A little more complicated, you can get the information you need through the command: Gacutil -l Microsoft.wsdk, if Gacutil doesn't have DUMP's information you need Microsoft.wsdk, then it may be unfortunate, your WSDK is not installed correctly.

When you complete the settings, you can compile and run this Web Services with DIME features. If the result shows that you are familiar with the Web Services blue interface, this part can be reported. Do not try to click the call button on HTML because your browser does not explain the DIME's SOAP message.

The same code in exchange is likely to be like this:

[WebMethod ()] public Byte [] GetImage () {string filename = "c: //dotnetflag.jpg"; System.Drawing.Bitmap sampleBitmap = new System.Drawing.Bitmap (filename); System.IO.MemoryStream memStream = New system.io.MemoryStream ();

SampleBitmap.Save (Memstream, System.drawing.Image.ImageFormat.jpeg); Return Memstream.toArray ();

You will say the previous simple, but if you have different image files or mixed binary data in a SOAP message, you will see that the next client is difficult to consume this web services, of course, I have no such thing. Example of the situation.

especially:

This article original, 9CBS signature start, all text and photo copyright. Do not propagate, reprint, or adaptation without authorization.

If you have any questions or suggestions, please email new2001@msn.com

转载请注明原文地址:https://www.9cbs.com/read-30982.html

New Post(0)