我正在尝试使用 Web 服务,尽管显然我的所有参数似乎都没有问题,但我一直收到一个错误页面作为响应,而不是我期望的字节数组以及 WebService 应该返回的字节数组。
My objective is to Seal a file in order to make them only readable for the right people. I am using the IRM Oracle Web Services to acomplish that, but, though all my parameters semm alright, I can't get the reponse properly.
Acording to the Oraclel support, my request is fine, so it must be something on IIS I guess. Any help?
异常消息:
响应的内容类型 multipart/related;start="";type="application/xop+xml";boundary="uuid:ab73a894-eaf4-4293-aa4e-c3358b95ec73";start-info="text/xml"消息与绑定的内容类型不匹配 (text/xml; charset=utf-8)。如果使用自定义编码器,请确保正确实现 IsContentTypeSupported 方法。响应的前 748 个字节是:'--uuid:ab73a894-eaf4-4293-aa4e-c3358b95ec73 Content-Id: Content-Type: application/xop+xml;charset=utf-8;type="text/xml"内容传输编码:二进制'。
异常堆栈跟踪:
服务器堆栈跟踪:在 System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) 处 System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding) .ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 的操作,Object[] 输入,Object[] 输出,TimeSpan 超时)。ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 在 [0] 处重新抛出异常:在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke( MessageData& msgData,Int32 类型)在 HTMLToPDFComponenteConverter.sealing_services.SealingServices.Seal(SealRequest 请求)在 HTMLToPDFComponenteConverter.sealing_services.SealingServicesClient.HTMLToPDFComponenteConverter.sealing_services.SealingServices.Seal(SealRequest 请求)在 HTMLToPDFComponenteConverter.sealing_services.SealingServicesClient.Seal(Byte[] 流, HTMLToPDFComponenteConverter.ConvertToPDF.Page_Load(Object sender, EventArgs e) 处的字符串 mimeType、SealingOptions 选项Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 在 HTMLToPDFComponenteConverter.sealing_services.SealingServices.Seal(SealRequest request) 在 HTMLToPDFComponenteConverter.sealing_services 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 类型)。 SealingServicesClient.HTMLToPDFComponenteConverter.sealing_services.SealingServices.Seal(SealRequest request) at HTMLToPDFComponenteConverter.sealing_services.SealingServicesClient.Seal(Byte[] stream, String mimeType, SealingOptions options) at HTMLToPDFComponenteConverter.ConvertToPDF.Page_Load(Object sender, EventArgs e)Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 在 HTMLToPDFComponenteConverter.sealing_services.SealingServices.Seal(SealRequest request) 在 HTMLToPDFComponenteConverter.sealing_services 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 类型)。 SealingServicesClient.HTMLToPDFComponenteConverter.sealing_services.SealingServices.Seal(SealRequest request) at HTMLToPDFComponenteConverter.sealing_services.SealingServicesClient.Seal(Byte[] stream, String mimeType, SealingOptions options) at HTMLToPDFComponenteConverter.ConvertToPDF.Page_Load(Object sender, EventArgs e)seal_services.SealingServices.Seal(SealRequest request) at HTMLToPDFComponenteConverter.sealing_services.SealingServicesClient.HTMLToPDFComponenteConverter.sealing_services.SealingServices.Seal(SealRequest request) at HTMLToPDFComponenteConverter.sealing_services.SealingServicesClient.Seal(Byte[] stream, String mimeType, SealingOptions options) at HTMLToPDFComponenteConverter。 ConvertToPDF.Page_Load(对象发送者,EventArgs e)seal_services.SealingServices.Seal(SealRequest request) at HTMLToPDFComponenteConverter.sealing_services.SealingServicesClient.HTMLToPDFComponenteConverter.sealing_services.SealingServices.Seal(SealRequest request) at HTMLToPDFComponenteConverter.sealing_services.SealingServicesClient.Seal(Byte[] stream, String mimeType, SealingOptions options) at HTMLToPDFComponenteConverter。 ConvertToPDF.Page_Load(对象发送者,EventArgs e)
异常数据:
System.Collections.ListDictionaryInternal
异常来源:
mscorlib
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.ContentType = "application/vnd.sealedmedia.softseal.pdf";
Response.AddHeader("Content-Disposition", "attachment; filename=Relatorio.spdf");
SealingServicesClient sealingServicesClient =
new SealingServicesClient("SealingServices");
sealingServicesClient.ClientCredentials.UserName.UserName =
ConfigurationManager.AppSettings["Irm-user"];
sealingServicesClient.ClientCredentials.UserName.Password =
ConfigurationManager.AppSettings["Irm-password"];
// Create the classification details used in the sealing options
SealingOptions sealingOptions = new SealingOptions();
// This just set several parameters which the WebService validates. (They're all okay)
sealingOptions.classification = GetClassificationSetUp();
String mimeType = "application/pdf";
// Here is where everything goes wrong. I keep getting an error message.
byte[] sealedFile = sealingServicesClient.Seal(file, mimeType, sealingOptions);
if (sealedFile != null && sealedFile.Length > 0)
{
Response.AddHeader("Content-Length", sealedFile.Length.ToString());
Response.BinaryWrite(sealedFile);
Response.Flush();
Response.End();
}
Meu WebConfig está desse jeito:
<system.serviceModel>
<client>
<endpoint address="https://url:porta/irm_sealing/sealing_services"
binding="basicHttpBinding" bindingConfiguration="SealingServicesBinding"
contract="sealing_services.SealingServices" name="SealingServices"
behaviorConfiguration="IrmSealingAbril">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
<behaviors>
<endpointBehaviors>
<behavior name="IrmSealingAbril">
<clientCredentials>
<clientCertificate storeLocation="LocalMachine"
storeName="Root"
x509FindType="FindByThumbprint"
findValue="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX">
</clientCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="SealingServicesBinding" closeTimeout="00:05:00"
openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2097152" maxBufferPoolSize="524288" maxReceivedMessageSize="2097152"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="Basic" realm="weblogic" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
我哪里错了?
附加信息:经甲骨文支持确认,该请求显然是正确的。但是,我无法得到返回响应。我认为这可能与 IIS 有关,但我没有配置它的技能。
提前致谢。