Consuming Webservice : Client application : C#











up vote
2
down vote

favorite
1












Error:




"System.ServiceModel.FaultException: InvalidSecurity : error in
processing the WS-Security security header" ...




Could anyone help on this issue



   public void CallServiceMNB()
{
ServiceReference1.SOAPCLIENT objMNB = new ServiceReference1.SOAPCLIENT();
ServiceReference1.SOAPCLIENTinput input = new ServiceReference1.SOAPCLIENTinput();
string Username = "xxx";
string Password = "xxxx";
objMNB.ClientCredentials.UserName.UserName = Username;
objMNB.ClientCredentials.UserName.Password = Password;
input.p_FROM_DATE = "01-01-2018";
input.p_JE_CATEGORY = "xxxx";
input.p_GROUP_ID = "";
input.p_JE_SOURCE = "YYYYYY";
input.p_LEDGER_NAME = "YYYYY";
input.p_TO_DATE = "31-12-2018";
try
{
objMNB.Open();
objMNB.GetGLDetails(input);
objMNB.Close();
}
catch (Exception Ex)
{
this.richTextBox1.Text = Ex.ToString();
objMNB.Close();
}
}


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="YYYYYY">
<!-- WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'http://gl.ws.apps.oracle.xxdof/': -->
<!-- <wsdl:binding name='YYYYYY'> -->
<!-- <sp:SupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">..</sp:SupportingTokens> -->




<textMessageEncoding messageVersion="Soap11" />
<httpsTransport />


</binding>
</customBinding>
</bindings>
<client>
<endpoint address="https://XXXXX"
binding="customBinding" bindingConfiguration="YYYYYY"
contract="ServiceReference1.SOAPCLIENT" name="SOAPCLIENT" />
</client>
</system.serviceModel>
</configuration>









share|improve this question









New contributor




Somu M is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • yes Mr. Holterman... I provided the above-mentioned code and correct username and password!! I got the result in using SOAPUI(smartbear). In C# facing the security issue. Is any reference need to be added ??? kindly help
    – Somu M
    Nov 4 at 10:03










  • You are getting closer to an answerable question. It seems to be WCF, you should add that tag.
    – Henk Holterman
    Nov 4 at 10:19










  • The complete exception text might help. And post the WCF configurations. The C# part looks OK but most WCF happens in app.config .
    – Henk Holterman
    Nov 4 at 10:22










  • No Mr.Holterman. I am not using WCF just using a website to consume SOAP Webservice.
    – Somu M
    Nov 4 at 10:55










  • I see a lot of WCF though... And "WsdlImporter encountered unrecognized policy assertions" might be the start of your problems.
    – Henk Holterman
    Nov 4 at 11:05















up vote
2
down vote

favorite
1












Error:




"System.ServiceModel.FaultException: InvalidSecurity : error in
processing the WS-Security security header" ...




Could anyone help on this issue



   public void CallServiceMNB()
{
ServiceReference1.SOAPCLIENT objMNB = new ServiceReference1.SOAPCLIENT();
ServiceReference1.SOAPCLIENTinput input = new ServiceReference1.SOAPCLIENTinput();
string Username = "xxx";
string Password = "xxxx";
objMNB.ClientCredentials.UserName.UserName = Username;
objMNB.ClientCredentials.UserName.Password = Password;
input.p_FROM_DATE = "01-01-2018";
input.p_JE_CATEGORY = "xxxx";
input.p_GROUP_ID = "";
input.p_JE_SOURCE = "YYYYYY";
input.p_LEDGER_NAME = "YYYYY";
input.p_TO_DATE = "31-12-2018";
try
{
objMNB.Open();
objMNB.GetGLDetails(input);
objMNB.Close();
}
catch (Exception Ex)
{
this.richTextBox1.Text = Ex.ToString();
objMNB.Close();
}
}


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="YYYYYY">
<!-- WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'http://gl.ws.apps.oracle.xxdof/': -->
<!-- <wsdl:binding name='YYYYYY'> -->
<!-- <sp:SupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">..</sp:SupportingTokens> -->




<textMessageEncoding messageVersion="Soap11" />
<httpsTransport />


</binding>
</customBinding>
</bindings>
<client>
<endpoint address="https://XXXXX"
binding="customBinding" bindingConfiguration="YYYYYY"
contract="ServiceReference1.SOAPCLIENT" name="SOAPCLIENT" />
</client>
</system.serviceModel>
</configuration>









share|improve this question









New contributor




Somu M is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • yes Mr. Holterman... I provided the above-mentioned code and correct username and password!! I got the result in using SOAPUI(smartbear). In C# facing the security issue. Is any reference need to be added ??? kindly help
    – Somu M
    Nov 4 at 10:03










  • You are getting closer to an answerable question. It seems to be WCF, you should add that tag.
    – Henk Holterman
    Nov 4 at 10:19










  • The complete exception text might help. And post the WCF configurations. The C# part looks OK but most WCF happens in app.config .
    – Henk Holterman
    Nov 4 at 10:22










  • No Mr.Holterman. I am not using WCF just using a website to consume SOAP Webservice.
    – Somu M
    Nov 4 at 10:55










  • I see a lot of WCF though... And "WsdlImporter encountered unrecognized policy assertions" might be the start of your problems.
    – Henk Holterman
    Nov 4 at 11:05













up vote
2
down vote

favorite
1









up vote
2
down vote

favorite
1






1





Error:




"System.ServiceModel.FaultException: InvalidSecurity : error in
processing the WS-Security security header" ...




Could anyone help on this issue



   public void CallServiceMNB()
{
ServiceReference1.SOAPCLIENT objMNB = new ServiceReference1.SOAPCLIENT();
ServiceReference1.SOAPCLIENTinput input = new ServiceReference1.SOAPCLIENTinput();
string Username = "xxx";
string Password = "xxxx";
objMNB.ClientCredentials.UserName.UserName = Username;
objMNB.ClientCredentials.UserName.Password = Password;
input.p_FROM_DATE = "01-01-2018";
input.p_JE_CATEGORY = "xxxx";
input.p_GROUP_ID = "";
input.p_JE_SOURCE = "YYYYYY";
input.p_LEDGER_NAME = "YYYYY";
input.p_TO_DATE = "31-12-2018";
try
{
objMNB.Open();
objMNB.GetGLDetails(input);
objMNB.Close();
}
catch (Exception Ex)
{
this.richTextBox1.Text = Ex.ToString();
objMNB.Close();
}
}


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="YYYYYY">
<!-- WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'http://gl.ws.apps.oracle.xxdof/': -->
<!-- <wsdl:binding name='YYYYYY'> -->
<!-- <sp:SupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">..</sp:SupportingTokens> -->




<textMessageEncoding messageVersion="Soap11" />
<httpsTransport />


</binding>
</customBinding>
</bindings>
<client>
<endpoint address="https://XXXXX"
binding="customBinding" bindingConfiguration="YYYYYY"
contract="ServiceReference1.SOAPCLIENT" name="SOAPCLIENT" />
</client>
</system.serviceModel>
</configuration>









share|improve this question









New contributor




Somu M is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











Error:




"System.ServiceModel.FaultException: InvalidSecurity : error in
processing the WS-Security security header" ...




Could anyone help on this issue



   public void CallServiceMNB()
{
ServiceReference1.SOAPCLIENT objMNB = new ServiceReference1.SOAPCLIENT();
ServiceReference1.SOAPCLIENTinput input = new ServiceReference1.SOAPCLIENTinput();
string Username = "xxx";
string Password = "xxxx";
objMNB.ClientCredentials.UserName.UserName = Username;
objMNB.ClientCredentials.UserName.Password = Password;
input.p_FROM_DATE = "01-01-2018";
input.p_JE_CATEGORY = "xxxx";
input.p_GROUP_ID = "";
input.p_JE_SOURCE = "YYYYYY";
input.p_LEDGER_NAME = "YYYYY";
input.p_TO_DATE = "31-12-2018";
try
{
objMNB.Open();
objMNB.GetGLDetails(input);
objMNB.Close();
}
catch (Exception Ex)
{
this.richTextBox1.Text = Ex.ToString();
objMNB.Close();
}
}


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="YYYYYY">
<!-- WsdlImporter encountered unrecognized policy assertions in ServiceDescription 'http://gl.ws.apps.oracle.xxdof/': -->
<!-- <wsdl:binding name='YYYYYY'> -->
<!-- <sp:SupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">..</sp:SupportingTokens> -->




<textMessageEncoding messageVersion="Soap11" />
<httpsTransport />


</binding>
</customBinding>
</bindings>
<client>
<endpoint address="https://XXXXX"
binding="customBinding" bindingConfiguration="YYYYYY"
contract="ServiceReference1.SOAPCLIENT" name="SOAPCLIENT" />
</client>
</system.serviceModel>
</configuration>






c# wcf soap ws-security






share|improve this question









New contributor




Somu M is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Somu M is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Nov 4 at 10:59









Henk Holterman

206k22222393




206k22222393






New contributor




Somu M is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 4 at 9:13









Somu M

92




92




New contributor




Somu M is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Somu M is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Somu M is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • yes Mr. Holterman... I provided the above-mentioned code and correct username and password!! I got the result in using SOAPUI(smartbear). In C# facing the security issue. Is any reference need to be added ??? kindly help
    – Somu M
    Nov 4 at 10:03










  • You are getting closer to an answerable question. It seems to be WCF, you should add that tag.
    – Henk Holterman
    Nov 4 at 10:19










  • The complete exception text might help. And post the WCF configurations. The C# part looks OK but most WCF happens in app.config .
    – Henk Holterman
    Nov 4 at 10:22










  • No Mr.Holterman. I am not using WCF just using a website to consume SOAP Webservice.
    – Somu M
    Nov 4 at 10:55










  • I see a lot of WCF though... And "WsdlImporter encountered unrecognized policy assertions" might be the start of your problems.
    – Henk Holterman
    Nov 4 at 11:05


















  • yes Mr. Holterman... I provided the above-mentioned code and correct username and password!! I got the result in using SOAPUI(smartbear). In C# facing the security issue. Is any reference need to be added ??? kindly help
    – Somu M
    Nov 4 at 10:03










  • You are getting closer to an answerable question. It seems to be WCF, you should add that tag.
    – Henk Holterman
    Nov 4 at 10:19










  • The complete exception text might help. And post the WCF configurations. The C# part looks OK but most WCF happens in app.config .
    – Henk Holterman
    Nov 4 at 10:22










  • No Mr.Holterman. I am not using WCF just using a website to consume SOAP Webservice.
    – Somu M
    Nov 4 at 10:55










  • I see a lot of WCF though... And "WsdlImporter encountered unrecognized policy assertions" might be the start of your problems.
    – Henk Holterman
    Nov 4 at 11:05
















yes Mr. Holterman... I provided the above-mentioned code and correct username and password!! I got the result in using SOAPUI(smartbear). In C# facing the security issue. Is any reference need to be added ??? kindly help
– Somu M
Nov 4 at 10:03




yes Mr. Holterman... I provided the above-mentioned code and correct username and password!! I got the result in using SOAPUI(smartbear). In C# facing the security issue. Is any reference need to be added ??? kindly help
– Somu M
Nov 4 at 10:03












You are getting closer to an answerable question. It seems to be WCF, you should add that tag.
– Henk Holterman
Nov 4 at 10:19




You are getting closer to an answerable question. It seems to be WCF, you should add that tag.
– Henk Holterman
Nov 4 at 10:19












The complete exception text might help. And post the WCF configurations. The C# part looks OK but most WCF happens in app.config .
– Henk Holterman
Nov 4 at 10:22




The complete exception text might help. And post the WCF configurations. The C# part looks OK but most WCF happens in app.config .
– Henk Holterman
Nov 4 at 10:22












No Mr.Holterman. I am not using WCF just using a website to consume SOAP Webservice.
– Somu M
Nov 4 at 10:55




No Mr.Holterman. I am not using WCF just using a website to consume SOAP Webservice.
– Somu M
Nov 4 at 10:55












I see a lot of WCF though... And "WsdlImporter encountered unrecognized policy assertions" might be the start of your problems.
– Henk Holterman
Nov 4 at 11:05




I see a lot of WCF though... And "WsdlImporter encountered unrecognized policy assertions" might be the start of your problems.
– Henk Holterman
Nov 4 at 11:05












1 Answer
1






active

oldest

votes

















up vote
1
down vote













The client credential depends on your SecurityBindingElement created in the Custom Binding hosting on the server.
https://docs.microsoft.com/en-us/dotnet/api/system.servicemodel.channels.securitybindingelement?view=netframework-4.7.2

You should add token to the security header in accordance with the authentication security mode of the Custom binding.

For the BasicHttpBinding, you need not to provide the credential by default, while we need to provide Windows account in Wshttpbinding by default.
https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/programming-wcf-security






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });






    Somu M is a new contributor. Be nice, and check out our Code of Conduct.










     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53139255%2fconsuming-webservice-client-application-c-sharp%23new-answer', 'question_page');
    }
    );

    Post as a guest
































    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    The client credential depends on your SecurityBindingElement created in the Custom Binding hosting on the server.
    https://docs.microsoft.com/en-us/dotnet/api/system.servicemodel.channels.securitybindingelement?view=netframework-4.7.2

    You should add token to the security header in accordance with the authentication security mode of the Custom binding.

    For the BasicHttpBinding, you need not to provide the credential by default, while we need to provide Windows account in Wshttpbinding by default.
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/programming-wcf-security






    share|improve this answer

























      up vote
      1
      down vote













      The client credential depends on your SecurityBindingElement created in the Custom Binding hosting on the server.
      https://docs.microsoft.com/en-us/dotnet/api/system.servicemodel.channels.securitybindingelement?view=netframework-4.7.2

      You should add token to the security header in accordance with the authentication security mode of the Custom binding.

      For the BasicHttpBinding, you need not to provide the credential by default, while we need to provide Windows account in Wshttpbinding by default.
      https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/programming-wcf-security






      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        The client credential depends on your SecurityBindingElement created in the Custom Binding hosting on the server.
        https://docs.microsoft.com/en-us/dotnet/api/system.servicemodel.channels.securitybindingelement?view=netframework-4.7.2

        You should add token to the security header in accordance with the authentication security mode of the Custom binding.

        For the BasicHttpBinding, you need not to provide the credential by default, while we need to provide Windows account in Wshttpbinding by default.
        https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/programming-wcf-security






        share|improve this answer












        The client credential depends on your SecurityBindingElement created in the Custom Binding hosting on the server.
        https://docs.microsoft.com/en-us/dotnet/api/system.servicemodel.channels.securitybindingelement?view=netframework-4.7.2

        You should add token to the security header in accordance with the authentication security mode of the Custom binding.

        For the BasicHttpBinding, you need not to provide the credential by default, while we need to provide Windows account in Wshttpbinding by default.
        https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/programming-wcf-security







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 days ago









        Abraham Qian

        3566




        3566






















            Somu M is a new contributor. Be nice, and check out our Code of Conduct.










             

            draft saved


            draft discarded


















            Somu M is a new contributor. Be nice, and check out our Code of Conduct.













            Somu M is a new contributor. Be nice, and check out our Code of Conduct.












            Somu M is a new contributor. Be nice, and check out our Code of Conduct.















             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53139255%2fconsuming-webservice-client-application-c-sharp%23new-answer', 'question_page');
            }
            );

            Post as a guest




















































































            這個網誌中的熱門文章

            Xamarin.form Move up view when keyboard appear

            Post-Redirect-Get with Spring WebFlux and Thymeleaf

            Anylogic : not able to use stopDelay()