分享
 
 
 

Some Note for Web Service.

王朝java/jsp·作者佚名  2006-01-10
窄屏简体版  字體: |||超大  

WS is really a magic tech. Although i have heard something about it before, i still was excited when i tought it.

Here is some key point for me, may be also for you. If you want to got more full information, you can find some book or find other tutiols. Here we go.

I want to talk about the server side first.

1 Server side

i first try to use java to build a web service, there are so many choise, http://ws.apache.org . I first choise SOAP, as i think it is more basic, however, i just found it a little complex and i could not find more documents about it. Then i try another famous product---axis. It's really easy. After the installion and user's guide on the site, i can basicly deploy some simple web services. links: http://ws.apache.org/axis/

Here are some key notes:

The installation is easy. First put the webapps/axis to any container, like tomcat. Then, You can validate the required package in the browser. Add all the requied package to the lib in WEB-INF.Axis use a .wsdd help you to deploy, it is useless in other environment. Instead, you needn't to write any .wsdl, but you can view it after deploy. Just Add "?wsdl" after the url of your webservice.

The deploy command with .wsdd is "java org.apache.axis.client.AdminClient deploy.wsdd" (you can change the filename of .wsdd)In the .wsdd, you can define you own type and make a mapping, like

<typeMapping qname="ns:local" xmlns:ns="someNamespace"

languageSpecificType="java:my.java.thingy"

encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>The ArrayList or Object[] also can be add to the mapping, like

<arrayMapping qname="ns:ArrayOfthingy" xmlns:ns="someNamespaceURI"

languageSpecificType="java:my.java.array.thingy[]"

innerType="ns2:thingy" xmlns:ns2="anotherNamespaceURI"

encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> After you writing the file and prepare the class to deploy, you could run the command above, when you see "Process Done" in command line, the server have been deployed. you can confirm it by view the wsdl in browser.

The C# is quite easy with vs.net. Just new a web service project and run it. The most simple one is OK.

Then the the client, often more complex

2 Client side

In client you can choose either the ligh level way or low level way (parse SOAP by you self),

i just want to talk about the high level way here. The other is so complex for me now

1) With java. There are at lease three ways:

you can use you defined class to send or receive the SOAP, if you will give the class to client . Realization with axis is very easy, you can find example in its samplesIf you haven't the original class but the wsdl, that's ok. You can use wscompile command to generate the all classes used in .wsdl for you. you can type wscompile -help to got more informationAnother way is use WSDL2JAVA, but i haven't try it. It is generate something like stub and skeleton. But it is said very simple. 2) With other languages

As a cross-language tech, the SOAP must can be read by other language. The main question is how can the customized type be understand. Of course, you can read a schema in wsdl, can parse the SOAP by you self, but there must be some easy way.

i just do something with c#, the vs.net is so powerful that make the process very easy. If you have got the WSDL or know the url of it, you can new a web service project, then add a web reference, type the url of wsdl, click ok and you will find every requied class in the method of web service, with has been write in C#. How great it is. Then you can use the class to invoke the method. Meanwhile,you will find a fold and some files in you project folder.

What about other language. There are may be the same way, but i haven't try it. The most great thing is even asp or javascript can use webservices. In worst way, i think i can use the lowest level way to operate the SOAP message.I am still trying.

Anyway, avoid using complex type is more easy to be used with other language

Other notes

You can use tcptrace or MS SOAP Toolkit to check the SOAP message. It is interesting because you can view call the http message through you server.

When you configure the tool, you 'd better know how it works. I reasearch it alot then sucessfully configure it.

There are three blank: client port, server name, server port.

You should change you code as:

When you client all web service, make the port to the "client port" value you have set, it could be any number.

Set the "server port." to the reail web service port. The server name is normal, even can be localhost.

Thus the message will go from cliect to the tool then to the sever. The return path is reversed.You can have some test with www.google.com/apis.

So many things i have learned today.

Good night.

If i get more,i will share them at once

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有