急求助: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)”; 

解决方案 »

  1.   

    当然引用了,现在的问题是myContext.Attachments.Add(dimAttach); 
    现在代码报错:myContext==null
      

  2.   

    还有人知道么?.net 通过附件的形式 发送文件到webservice
      

  3.   

    SPCServiceService spss = new SPCServiceService(); 
    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 谁能帮我测试一下啊
      

  4.   

    .net和Java的交互不是很好 我采用的是Json字符串传递的方式
      

  5.   

    顶一下,
    进来的兄弟们都帮忙顶一下,不能沉下去啊,很现实的问题,要解决!“.net和Java的交互不是很好”,无法选择,对方就是java,而我只能用net
      

  6.   

    .NET联盟会馆 QQ群号:77329563  招聘中.....
      

  7.   

    我跟楼主刚好反了,我用的java,要接收别人传来的soap附件,对方是用.net写的,那结果我这边就报xml参数不合法。我发给他的倒没问题,崩溃中