title: Error obtaining the response from a Web Service call
body: <p>I am trying to consume a Web Service and, though apparently all my parameters seem to be okay, I keep getting an erro page as response instead of an array of bytes which is what I am expecting and what the WebService is supposed to return.</p>
  
  <pre><code>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?
  </code></pre>
  
  <hr>
  
  <p>Exception Message:</p>
  
  <p>The content type multipart/related;start="";type="application/xop+xml";boundary="uuid:ab73a894-eaf4-4293-aa4e-c3358b95ec73";start-info="text/xml" of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 748 bytes of the response were: '--uuid:ab73a894-eaf4-4293-aa4e-c3358b95ec73 Content-Id: Content-Type: application/xop+xml;charset=utf-8;type="text/xml" Content-Transfer-Encoding: binary '.</p>
  
  <p>Exception Stacktrace:</p>
  
  <p>Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.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 operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type) at HTMLToPDFComponenteConverter.sealing_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(Object sender, EventArgs e)</p>
  
  <p>Exception Data:</p>
  
  <p>System.Collections.ListDictionaryInternal</p>
  
  <p>Exception Source:</p>
  
  <p>mscorlib</p>
  
  <hr>
  
  <pre><code>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 &amp;&amp; sealedFile.Length &gt; 0)
  {
      Response.AddHeader("Content-Length", sealedFile.Length.ToString());
      Response.BinaryWrite(sealedFile);
      Response.Flush();
      Response.End();
  }
  </code></pre>
  
  <hr>
  
  <p>Meu WebConfig está desse jeito:</p>
  
  <hr>
  
  <pre><code>&lt;system.serviceModel&gt;
          &lt;client&gt;
                  &lt;endpoint address="https://url:porta/irm_sealing/sealing_services"
                          binding="basicHttpBinding" bindingConfiguration="SealingServicesBinding"
                          contract="sealing_services.SealingServices" name="SealingServices"
                          behaviorConfiguration="IrmSealingAbril"&gt;
                          &lt;identity&gt;
                                  &lt;dns value="localhost" /&gt;
                          &lt;/identity&gt;
                  &lt;/endpoint&gt;
          &lt;/client&gt;
          &lt;behaviors&gt;
                  &lt;endpointBehaviors&gt;
                          &lt;behavior name="IrmSealingAbril"&gt;
                                  &lt;clientCredentials&gt;
                                          &lt;clientCertificate storeLocation="LocalMachine"
                                                                             storeName="Root"
                                                                             x509FindType="FindByThumbprint"
                                                                             findValue="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"&gt;
                                          &lt;/clientCertificate&gt;
                                  &lt;/clientCredentials&gt;
                          &lt;/behavior&gt;
        &lt;/endpointBehaviors&gt;
      &lt;/behaviors&gt;
          &lt;bindings&gt;
                  &lt;basicHttpBinding&gt;
                          &lt;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"&gt;
                      &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                          maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                                  &lt;security mode="Transport"&gt;
                                          &lt;transport clientCredentialType="Basic" realm="weblogic" /&gt;
                                  &lt;/security&gt;
                          &lt;/binding&gt;
                  &lt;/basicHttpBinding&gt;
      &lt;/bindings&gt;
    &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>Where am I going wrong?</p>
  
  <p>Additional information: The request apparently is correct as confirmed by oracle support. However, I can't get the returning response. I thought it could be something related to the IIS, but I do not have mush skill at configuring it.</p>
  
  <p>Thanks in advance.</p>