WCF Rest service always assigning null to parameter

时间:2016-07-11 21:29:31

标签: c# angularjs rest wcf

Have this service, using WCF, the method for using this is by POST. This is the definition of the service:

[OperationContract]
[WebInvoke(Method = "POST",
            ResponseFormat = WebMessageFormat.Json,
            RequestFormat = WebMessageFormat.Json,
            UriTemplate = "/POST_UploadArchivoConciliacionP_JSON")]
ResultadoConciliacion importarProvisionesExtornosConciliacionPorUrl(Params_AdjuntarConciliacion jsonData);

The Params_AdjuntarConciliacion have this fields:

public class Params_AdjuntarConciliacion
{
    public string url { get; set; }
}

And this is the configuration for this service:

<system.serviceModel>
    <services>
      <service name="SP_ProvisionesWCF.BandejaConciliacion.BandejaConciliacionWCF">
        <endpoint address="" binding="webHttpBinding" behaviorConfiguration="BandejaConciliacionWCFBehavior" contract="SP_ProvisionesWCF.BandejaConciliacion.IBandejaConciliacionWCF" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="BandejaConciliacionWCFBehavior">
          <webHttp faultExceptionEnabled="true"/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <webHttpBinding>
        <binding maxBufferPoolSize="5242880" maxReceivedMessageSize="5242880" maxBufferSize="5242880" transferMode="Streamed"></binding>
      </webHttpBinding>
    </bindings>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

After All of this, when calling the service using AngularJS

$http({
    method:'POST',
    url:cSetting.c_Url+'/WCF/BandejaConciliacion/BandejaConciliacionWCF.svc/POST_UploadArchivoConciliacionP_JSON',
    headers: { 'Content-Type': 'application/json; charset=utf-8;' },
    data: {
        "url":url
    }
});

I get this error:

<Fault xmlns="http://schemas.microsoft.com/ws/2005/05/envelope/none">
<Code>
<Value>Receiver</Value>
<Subcode>
<Value xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</Value>
</Subcode>
</Code>
<Reason>
<Text xml:lang="es-PE">Object reference not set to an instance of an object.</Text>
</Reason>
<Detail>
<ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<HelpLink i:nil="true" />
<InnerException i:nil="true" />
<Message>Object reference not set to an instance of an object.</Message>
<StackTrace>   at SP_ProvisionesWCF.BandejaConciliacion.BandejaConciliacionWCF.importarProvisionesExtornosConciliacionPorUrl(Params_AdjuntarConciliacion parametros)
   at SyncInvokeimportarProvisionesExtornosConciliacionPorUrl(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace>
<Type>System.NullReferenceException</Type>
</ExceptionDetail>
</Detail>
</Fault>

I ma really desperate beacuse I don't find the issue.

0 个答案:

没有答案