Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. can any one help me with this WS?

can any one help me with this WS?

Scheduled Pinned Locked Moved C#
asp-netwcfhelpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 13377166
    wrote on last edited by
    #1

    Im trying to consume this WS and response NULL. I dont know why because when I test it in boomerang tool work good. Please if someone can help me :( The method dont receive parameters and return a string.

    using Tassadar.Core.Interfaces;
    using ServiceSeedReference;
    using System.Threading.Tasks;

    namespace Tassadar.Infrastucture.Repositories
    {
    public class FacturaRepository : IFacturaRepository
    {

        public string GetSeedSII()
        {
            string s2;
    
            CrSeedClient seedClient = new CrSeedClient();
    
            s2 = seedClient.getSeed(); //RETURN NULL I DONT KNOW WHY
    
            return s2;
        }
    
    }
    

    }

    Is a public WS. wsdl: https://palena.sii.cl/DTEWS/CrSeed.jws?WSDL[^] Thanks!! PD: sorry for my english!

    D D 2 Replies Last reply
    0
    • M Member 13377166

      Im trying to consume this WS and response NULL. I dont know why because when I test it in boomerang tool work good. Please if someone can help me :( The method dont receive parameters and return a string.

      using Tassadar.Core.Interfaces;
      using ServiceSeedReference;
      using System.Threading.Tasks;

      namespace Tassadar.Infrastucture.Repositories
      {
      public class FacturaRepository : IFacturaRepository
      {

          public string GetSeedSII()
          {
              string s2;
      
              CrSeedClient seedClient = new CrSeedClient();
      
              s2 = seedClient.getSeed(); //RETURN NULL I DONT KNOW WHY
      
              return s2;
          }
      
      }
      

      }

      Is a public WS. wsdl: https://palena.sii.cl/DTEWS/CrSeed.jws?WSDL[^] Thanks!! PD: sorry for my english!

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      You're going to have to contact the vendor for this one. Everything is being done by the "CrSeedClient" class, but nobody but the vendor knows what the class is doing, what it is expecting from your code, or how it works.

      Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
      Dave Kreskowiak

      1 Reply Last reply
      0
      • M Member 13377166

        Im trying to consume this WS and response NULL. I dont know why because when I test it in boomerang tool work good. Please if someone can help me :( The method dont receive parameters and return a string.

        using Tassadar.Core.Interfaces;
        using ServiceSeedReference;
        using System.Threading.Tasks;

        namespace Tassadar.Infrastucture.Repositories
        {
        public class FacturaRepository : IFacturaRepository
        {

            public string GetSeedSII()
            {
                string s2;
        
                CrSeedClient seedClient = new CrSeedClient();
        
                s2 = seedClient.getSeed(); //RETURN NULL I DONT KNOW WHY
        
                return s2;
            }
        
        }
        

        }

        Is a public WS. wsdl: https://palena.sii.cl/DTEWS/CrSeed.jws?WSDL[^] Thanks!! PD: sorry for my english!

        D Offline
        D Offline
        DerekT P
        wrote on last edited by
        #3

        getSeed requires a parameter of type getSeedRequest, and returns a getSeedResponse object. Testing this in a console app:

                CrSeedClient client = new CrSeedClient();
                getSeedRequest req = new getSeedRequest();
                getSeedResponse resp = client.getSeed(req);
        

        runs OK but still returns null in resp. If I omit the getSeedRequest parameter it won't compile. However, if I run the above code with Fiddler listening in, then I can see the response received does actually contain XML, and is not null. Not entirely sure what's happening here but I suspect there's no implementation of getSeedRequest.ToString() so it returns nothing. As a workaround, the following seems to work fine:

        using System.Diagnostics;
        using System.IO;
        using System.Net;
        using System.Text;
        using System.Xml;
        namespace ConsoleApplication1
        {
        class Program
        {
        static void Main(string[] args)
        {
        WebRequest webreq = WebRequest.Create("https://palena.sii.cl/DTEWS/CrSeed.jws?WSDL");
        webreq.Headers.Add("SOAPAction", "");
        webreq.Method = "POST";
        byte[] bData = Encoding.ASCII.GetBytes("");
        webreq.GetRequestStream().Write(bData, 0, bData.Length);

                WebResponse webresp = webreq.GetResponse();
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(new StreamReader(webresp.GetResponseStream()).ReadToEnd());
                Debug.WriteLine(doc.InnerText);
            }
        }
        

        }

        M 1 Reply Last reply
        0
        • D DerekT P

          getSeed requires a parameter of type getSeedRequest, and returns a getSeedResponse object. Testing this in a console app:

                  CrSeedClient client = new CrSeedClient();
                  getSeedRequest req = new getSeedRequest();
                  getSeedResponse resp = client.getSeed(req);
          

          runs OK but still returns null in resp. If I omit the getSeedRequest parameter it won't compile. However, if I run the above code with Fiddler listening in, then I can see the response received does actually contain XML, and is not null. Not entirely sure what's happening here but I suspect there's no implementation of getSeedRequest.ToString() so it returns nothing. As a workaround, the following seems to work fine:

          using System.Diagnostics;
          using System.IO;
          using System.Net;
          using System.Text;
          using System.Xml;
          namespace ConsoleApplication1
          {
          class Program
          {
          static void Main(string[] args)
          {
          WebRequest webreq = WebRequest.Create("https://palena.sii.cl/DTEWS/CrSeed.jws?WSDL");
          webreq.Headers.Add("SOAPAction", "");
          webreq.Method = "POST";
          byte[] bData = Encoding.ASCII.GetBytes("");
          webreq.GetRequestStream().Write(bData, 0, bData.Length);

                  WebResponse webresp = webreq.GetResponse();
                  XmlDocument doc = new XmlDocument();
                  doc.LoadXml(new StreamReader(webresp.GetResponseStream()).ReadToEnd());
                  Debug.WriteLine(doc.InnerText);
              }
          }
          

          }

          M Offline
          M Offline
          Member 13377166
          wrote on last edited by
          #4

          Thanks! Thats work me :thumbsup::thumbsup::thumbsup:

          D 1 Reply Last reply
          0
          • M Member 13377166

            Thanks! Thats work me :thumbsup::thumbsup::thumbsup:

            D Offline
            D Offline
            DerekT P
            wrote on last edited by
            #5

            Glad you've got it going. Hopefully you can modify this code for any other calls you need for that Webservice.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups