急求助:asp.net调用java写的webservice,已附件的形式发送文件到webservice
http://topic.csdn.net/u/20081205/20/d6571d44-addc-4165-aff7-545700cf5cdf.html
webservice的内容
XML code
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:intf="http://211.137.84.182/services/SPCService" xmlns:impl="http://211.137.84.182/services/SPCService" targetNamespace="http://211.137.84.182/services/SPCService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types />
<wsdl:message name="submitMutilMessageRequest">
<wsdl:part name="in0" type="soapenc:string" />
<wsdl:part name="in1" type="soapenc:string" />
<wsdl:part name="in2" type="soapenc:string" />
<wsdl:part name="in3" type="soapenc:string" />
</wsdl:message>
<wsdl:message name="submitAtMutilMessageResponse">
<wsdl:part name="submitAtMutilMessageReturn" type="soapenc:string" />
</wsdl:message>
<wsdl:message name="submitMutilMessageResponse">
<wsdl:part name="submitMutilMessageReturn" type="soapenc:string" />
</wsdl:message>
<wsdl:message name="submitMutilMessageResponse1">
<wsdl:part name="submitMutilMessageReturn" type="soapenc:string" />
</wsdl:message>
<wsdl:message name="submitAtMutilMessageRequest1">
<wsdl:part name="in0" type="soapenc:string" />
<wsdl:part name="in1" type="soapenc:string" />
</wsdl:message>
<wsdl:message name="submitAtMutilMessageRequest">
<wsdl:part name="in0" type="soapenc:string" />
<wsdl:part name="in1" type="soapenc:string" />
<wsdl:part name="in2" type="soapenc:string" />
</wsdl:message>
<wsdl:message name="submitMutilMessageRequest1">
<wsdl:part name="in0" type="soapenc:string" />
<wsdl:part name="in1" type="soapenc:string" />
<wsdl:part name="in2" type="soapenc:string" />
</wsdl:message>
<wsdl:message name="submitAtMutilMessageResponse1">
<wsdl:part name="submitAtMutilMessageReturn" type="soapenc:string" />
</wsdl:message>
<wsdl:portType name="SPCService">
<wsdl:operation name="submitAtMutilMessage" parameterOrder="in0 in1 in2">
<wsdl:input name="submitAtMutilMessageRequest" message="impl:submitAtMutilMessageRequest" />
<wsdl:output name="submitAtMutilMessageResponse" message="impl:submitAtMutilMessageResponse" />
</wsdl:operation>
<wsdl:operation name="submitAtMutilMessage" parameterOrder="in0 in1">
<wsdl:input name="submitAtMutilMessageRequest1" message="impl:submitAtMutilMessageRequest1" />
<wsdl:output name="submitAtMutilMessageResponse1" message="impl:submitAtMutilMessageResponse1" />
</wsdl:operation>
<wsdl:operation name="submitMutilMessage" parameterOrder="in0 in1 in2 in3">
<wsdl:input name="submitMutilMessageRequest" message="impl:submitMutilMessageRequest" />
<wsdl:output name="submitMutilMessageResponse" message="impl:submitMutilMessageResponse" />
</wsdl:operation>
<wsdl:operation name="submitMutilMessage" parameterOrder="in0 in1 in2">
<wsdl:input name="submitMutilMessageRequest1" message="impl:submitMutilMessageRequest1" />
<wsdl:output name="submitMutilMessageResponse1" message="impl:submitMutilMessageResponse1" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SPCServiceSoapBinding" type="impl:SPCService">
<wsdlsoap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
<wsdl:operation name="submitAtMutilMessage">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="submitAtMutilMessageRequest">
<wsdlsoap:body use="encoded" namespace="http://sms.dev.hcsp.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:input>
<wsdl:output name="submitAtMutilMessageResponse">
<wsdlsoap:body use="encoded" namespace="http://211.137.84.182/services/SPCService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="submitAtMutilMessage">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="submitAtMutilMessageRequest1">
<wsdlsoap:body use="encoded" namespace="http://sms.dev.hcsp.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:input>
<wsdl:output name="submitAtMutilMessageResponse1">
<wsdlsoap:body use="encoded" namespace="http://211.137.84.182/services/SPCService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="submitMutilMessage">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="submitMutilMessageRequest">
<wsdlsoap:body use="encoded" namespace="http://sms.dev.hcsp.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:input>
<wsdl:output name="submitMutilMessageResponse">
<wsdlsoap:body use="encoded" namespace="http://211.137.84.182/services/SPCService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="submitMutilMessage">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="submitMutilMessageRequest1">
<wsdlsoap:body use="encoded" namespace="http://sms.dev.hcsp.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:input>
<wsdl:output name="submitMutilMessageResponse1">
<wsdlsoap:body use="encoded" namespace="http://211.137.84.182/services/SPCService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SPCServiceService">
<wsdl:port name="SPCService" binding="impl:SPCServiceSoapBinding">
<wsdlsoap:address location="http://211.137.84.182/services/SPCService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
我的调用代码: C# code
using System.Net;
using WebReference;
using System.Web.Services;
using Microsoft.Web.Services;
using Microsoft.Web.Services.Dime;SPCServiceService spss = new SPCServiceService();
SoapContext myContext = HttpSoapContext.ResponseContext;
DimeAttachment dimAttach = new DimeAttachment("text/plain", TypeFormatEnum.MediaType, filepath);
myContext.Attachments.Add(dimAttach);
string bb = spss.submitAtMutilMessage("port", "service_id", content);
找不到wsdk,我安装了 WSE3.0,但是没找到 Dime;
然后又安装了WSE2.0有了Dime,但是找不到 HttpSoapContext;
最后安装了WSE1.0;
现在代码报错:myContext==null,我不知道该怎么写了,特此求助!
说明,
1、webservice是对方的,用java写的,不可修改;
2、必须用soap附件的形式将文件发送过去,不能用base64的参数形式;
3、发送附件并且调用webservice的submitAtMutilMessage方法,传递参数“("port", "service_id", content)”;
http://topic.csdn.net/u/20081205/20/d6571d44-addc-4165-aff7-545700cf5cdf.html
webservice的内容
XML code
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:intf="http://211.137.84.182/services/SPCService" xmlns:impl="http://211.137.84.182/services/SPCService" targetNamespace="http://211.137.84.182/services/SPCService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types />
<wsdl:message name="submitMutilMessageRequest">
<wsdl:part name="in0" type="soapenc:string" />
<wsdl:part name="in1" type="soapenc:string" />
<wsdl:part name="in2" type="soapenc:string" />
<wsdl:part name="in3" type="soapenc:string" />
</wsdl:message>
<wsdl:message name="submitAtMutilMessageResponse">
<wsdl:part name="submitAtMutilMessageReturn" type="soapenc:string" />
</wsdl:message>
<wsdl:message name="submitMutilMessageResponse">
<wsdl:part name="submitMutilMessageReturn" type="soapenc:string" />
</wsdl:message>
<wsdl:message name="submitMutilMessageResponse1">
<wsdl:part name="submitMutilMessageReturn" type="soapenc:string" />
</wsdl:message>
<wsdl:message name="submitAtMutilMessageRequest1">
<wsdl:part name="in0" type="soapenc:string" />
<wsdl:part name="in1" type="soapenc:string" />
</wsdl:message>
<wsdl:message name="submitAtMutilMessageRequest">
<wsdl:part name="in0" type="soapenc:string" />
<wsdl:part name="in1" type="soapenc:string" />
<wsdl:part name="in2" type="soapenc:string" />
</wsdl:message>
<wsdl:message name="submitMutilMessageRequest1">
<wsdl:part name="in0" type="soapenc:string" />
<wsdl:part name="in1" type="soapenc:string" />
<wsdl:part name="in2" type="soapenc:string" />
</wsdl:message>
<wsdl:message name="submitAtMutilMessageResponse1">
<wsdl:part name="submitAtMutilMessageReturn" type="soapenc:string" />
</wsdl:message>
<wsdl:portType name="SPCService">
<wsdl:operation name="submitAtMutilMessage" parameterOrder="in0 in1 in2">
<wsdl:input name="submitAtMutilMessageRequest" message="impl:submitAtMutilMessageRequest" />
<wsdl:output name="submitAtMutilMessageResponse" message="impl:submitAtMutilMessageResponse" />
</wsdl:operation>
<wsdl:operation name="submitAtMutilMessage" parameterOrder="in0 in1">
<wsdl:input name="submitAtMutilMessageRequest1" message="impl:submitAtMutilMessageRequest1" />
<wsdl:output name="submitAtMutilMessageResponse1" message="impl:submitAtMutilMessageResponse1" />
</wsdl:operation>
<wsdl:operation name="submitMutilMessage" parameterOrder="in0 in1 in2 in3">
<wsdl:input name="submitMutilMessageRequest" message="impl:submitMutilMessageRequest" />
<wsdl:output name="submitMutilMessageResponse" message="impl:submitMutilMessageResponse" />
</wsdl:operation>
<wsdl:operation name="submitMutilMessage" parameterOrder="in0 in1 in2">
<wsdl:input name="submitMutilMessageRequest1" message="impl:submitMutilMessageRequest1" />
<wsdl:output name="submitMutilMessageResponse1" message="impl:submitMutilMessageResponse1" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SPCServiceSoapBinding" type="impl:SPCService">
<wsdlsoap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
<wsdl:operation name="submitAtMutilMessage">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="submitAtMutilMessageRequest">
<wsdlsoap:body use="encoded" namespace="http://sms.dev.hcsp.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:input>
<wsdl:output name="submitAtMutilMessageResponse">
<wsdlsoap:body use="encoded" namespace="http://211.137.84.182/services/SPCService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="submitAtMutilMessage">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="submitAtMutilMessageRequest1">
<wsdlsoap:body use="encoded" namespace="http://sms.dev.hcsp.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:input>
<wsdl:output name="submitAtMutilMessageResponse1">
<wsdlsoap:body use="encoded" namespace="http://211.137.84.182/services/SPCService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="submitMutilMessage">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="submitMutilMessageRequest">
<wsdlsoap:body use="encoded" namespace="http://sms.dev.hcsp.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:input>
<wsdl:output name="submitMutilMessageResponse">
<wsdlsoap:body use="encoded" namespace="http://211.137.84.182/services/SPCService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="submitMutilMessage">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="submitMutilMessageRequest1">
<wsdlsoap:body use="encoded" namespace="http://sms.dev.hcsp.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:input>
<wsdl:output name="submitMutilMessageResponse1">
<wsdlsoap:body use="encoded" namespace="http://211.137.84.182/services/SPCService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SPCServiceService">
<wsdl:port name="SPCService" binding="impl:SPCServiceSoapBinding">
<wsdlsoap:address location="http://211.137.84.182/services/SPCService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
我的调用代码: C# code
using System.Net;
using WebReference;
using System.Web.Services;
using Microsoft.Web.Services;
using Microsoft.Web.Services.Dime;SPCServiceService spss = new SPCServiceService();
SoapContext myContext = HttpSoapContext.ResponseContext;
DimeAttachment dimAttach = new DimeAttachment("text/plain", TypeFormatEnum.MediaType, filepath);
myContext.Attachments.Add(dimAttach);
string bb = spss.submitAtMutilMessage("port", "service_id", content);
找不到wsdk,我安装了 WSE3.0,但是没找到 Dime;
然后又安装了WSE2.0有了Dime,但是找不到 HttpSoapContext;
最后安装了WSE1.0;
现在代码报错:myContext==null,我不知道该怎么写了,特此求助!
说明,
1、webservice是对方的,用java写的,不可修改;
2、必须用soap附件的形式将文件发送过去,不能用base64的参数形式;
3、发送附件并且调用webservice的submitAtMutilMessage方法,传递参数“("port", "service_id", content)”;
解决方案 »
- 数据导入、导出 顺便问 int idStart=default(int) 这种方式是什么意思
- 求一套.net采集房源数据思路!
- VS 2005中打包安装后出现的错误
- 问题自己讲不清楚,你们看一下可能就答案知道了
- 有谁用过这个.net2.0代码实例啊?怎么安装时没有显示安装路径?
- _______郁闷问题,用户控件中的菜单控件不能显示
- 讨论贴:对DataTable里的列进行混合运算后,得到新的列,然后返回这个DataTable,供DataGrid使用.
- System.UnauthorizedAccessException: Access is denied
- UltraWebGrid
- DataGrid问题?
- ASP.NET分层的意义?
- 急需解决:如何实现一个图片控件绑定多张图片?
现在代码报错:myContext==null
DimeAttachmentCollection dac = new DimeAttachmentCollection();
DimeAttachment dimAttach = new DimeAttachment("text/plain", TypeFormat.MediaType, filepath);
dac.Add(dimAttach);
string bb = spss.submitAtMutilMessage("106537831", "-SCYYYY", "SendSMS");
Response.Write(bb);
不报错了,但是返回 rtcd=-1|rtmsg=文件传送失败http://211.137.84.182/services/SPCService?wsdl 谁能帮我测试一下啊
进来的兄弟们都帮忙顶一下,不能沉下去啊,很现实的问题,要解决!“.net和Java的交互不是很好”,无法选择,对方就是java,而我只能用net