日期:2014-05-18  浏览次数:20896 次

web service 里的方法调用时参数的问题
描述:
在webservice里有一个方法A,参数是自定义dll——userdll——里一个类B的对象。
例如:A(string s,B b),userdll已经引用到了该webservice中。
在另一个dll——project——中,引用了这个webservice,在一个方法中定义了B的对象,并调用方法A,但是编译时出错。
说参数不匹配,userdll.B 无法转换为project.webservice.B。

问题:
1、为什么在webservice在dll中和一般的工程中的引用不一样。有些东西dll里面是没有的。在一般的工程中的web引用下会有一些文件(Reference.map,service.disco,service.wsdl),但dll下就没有。
2、在project中,我也引用了userdll,然后才B b=new B(), 再调用A(s,b)。为什么编译时会认为b是webservice下的而不是userdll下的呢?
3、我程序中出现的问题该如何解决。

请大家帮忙。

------解决方案--------------------
试一试:在Project中这样定义对象B,
Project.WebService.B b = new Project.WebService.B();

Reference.map,service.disco,service.wsdl等文件是Project用来查找和发现你的WebService的。
------解决方案--------------------
I think you must write the class B in the WebService.
When the new project reference the webservice, the only can use
the webservice's content, the project can't know the dll
that webservice have referenced.

if you want to use Class B in userdll, you can reference the userdll
in the new project and then please use the full namespace(must).

you can try it.