Is it possible to use python suds to read a wsdl file from the file system?












38














From suds documentation, I can create a Client if I have a url for the WSDL.



from suds.client import Client
url = 'http://localhost:7080/webservices/WebServiceTestBean?wsdl'
client = Client(url)


I currently have the WSDL file on my file system. Is it possible to use suds to read the WSDL file from my file system instead of hosting it on a web server?










share|improve this question



























    38














    From suds documentation, I can create a Client if I have a url for the WSDL.



    from suds.client import Client
    url = 'http://localhost:7080/webservices/WebServiceTestBean?wsdl'
    client = Client(url)


    I currently have the WSDL file on my file system. Is it possible to use suds to read the WSDL file from my file system instead of hosting it on a web server?










    share|improve this question

























      38












      38








      38


      8





      From suds documentation, I can create a Client if I have a url for the WSDL.



      from suds.client import Client
      url = 'http://localhost:7080/webservices/WebServiceTestBean?wsdl'
      client = Client(url)


      I currently have the WSDL file on my file system. Is it possible to use suds to read the WSDL file from my file system instead of hosting it on a web server?










      share|improve this question













      From suds documentation, I can create a Client if I have a url for the WSDL.



      from suds.client import Client
      url = 'http://localhost:7080/webservices/WebServiceTestBean?wsdl'
      client = Client(url)


      I currently have the WSDL file on my file system. Is it possible to use suds to read the WSDL file from my file system instead of hosting it on a web server?







      python soap wsdl suds






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 28 '10 at 19:49









      Thierry Lam

      19k3396136




      19k3396136
























          2 Answers
          2






          active

          oldest

          votes


















          51














          try to use url='file:///path/to/file'






          share|improve this answer























          • This is the correct answer.
            – jathanism
            Oct 28 '10 at 22:36






          • 5




            I had to add an extra slash, thanks for the answer.
            – Thierry Lam
            Nov 1 '10 at 14:38






          • 8




            To add to Thierry's comment, it also has to be an absolute path. (eg. file:///home/admin/service.xml)
            – trinth
            May 9 '12 at 16:14



















          14














          Oneliner





          # Python 3
          import urllib, os
          url = urllib.parse.urljoin('file:', urllib.request.pathname2url(os.path.abspath("service.xml")))


          This is a more complete one liner that will:




          • let you specify just the local path,

          • get you the absolute path,

          • and then format it as a file-url.


          Based upon:




          • the comments in the accepted answer and

          • this https://stackoverflow.com/a/14298190/622276

          • and thanks to user Sebastian the updated Python 3 implementation since we should avoid writing legacy python at this time.


          Original for reference





          # Python 2 (Legacy Python)
          import urlparse, urllib, os

          url = urlparse.urljoin('file:', urllib.pathname2url(os.path.abspath("service.xml")))





          share|improve this answer



















          • 1




            In case someone is using python3, the names have changed: import urllib, os url = urllib.parse.urljoin('file:', urllib.request.pathname2url(os.path.abspath("service.xml")))
            – Sebastian
            Jul 1 '17 at 9:51













          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',
          autoActivateHeartbeat: false,
          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
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f4046628%2fis-it-possible-to-use-python-suds-to-read-a-wsdl-file-from-the-file-system%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          51














          try to use url='file:///path/to/file'






          share|improve this answer























          • This is the correct answer.
            – jathanism
            Oct 28 '10 at 22:36






          • 5




            I had to add an extra slash, thanks for the answer.
            – Thierry Lam
            Nov 1 '10 at 14:38






          • 8




            To add to Thierry's comment, it also has to be an absolute path. (eg. file:///home/admin/service.xml)
            – trinth
            May 9 '12 at 16:14
















          51














          try to use url='file:///path/to/file'






          share|improve this answer























          • This is the correct answer.
            – jathanism
            Oct 28 '10 at 22:36






          • 5




            I had to add an extra slash, thanks for the answer.
            – Thierry Lam
            Nov 1 '10 at 14:38






          • 8




            To add to Thierry's comment, it also has to be an absolute path. (eg. file:///home/admin/service.xml)
            – trinth
            May 9 '12 at 16:14














          51












          51








          51






          try to use url='file:///path/to/file'






          share|improve this answer














          try to use url='file:///path/to/file'







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 28 '14 at 15:19









          sherpya

          4,04712144




          4,04712144










          answered Oct 28 '10 at 19:51









          Gabi Purcaru

          23.8k75882




          23.8k75882












          • This is the correct answer.
            – jathanism
            Oct 28 '10 at 22:36






          • 5




            I had to add an extra slash, thanks for the answer.
            – Thierry Lam
            Nov 1 '10 at 14:38






          • 8




            To add to Thierry's comment, it also has to be an absolute path. (eg. file:///home/admin/service.xml)
            – trinth
            May 9 '12 at 16:14


















          • This is the correct answer.
            – jathanism
            Oct 28 '10 at 22:36






          • 5




            I had to add an extra slash, thanks for the answer.
            – Thierry Lam
            Nov 1 '10 at 14:38






          • 8




            To add to Thierry's comment, it also has to be an absolute path. (eg. file:///home/admin/service.xml)
            – trinth
            May 9 '12 at 16:14
















          This is the correct answer.
          – jathanism
          Oct 28 '10 at 22:36




          This is the correct answer.
          – jathanism
          Oct 28 '10 at 22:36




          5




          5




          I had to add an extra slash, thanks for the answer.
          – Thierry Lam
          Nov 1 '10 at 14:38




          I had to add an extra slash, thanks for the answer.
          – Thierry Lam
          Nov 1 '10 at 14:38




          8




          8




          To add to Thierry's comment, it also has to be an absolute path. (eg. file:///home/admin/service.xml)
          – trinth
          May 9 '12 at 16:14




          To add to Thierry's comment, it also has to be an absolute path. (eg. file:///home/admin/service.xml)
          – trinth
          May 9 '12 at 16:14













          14














          Oneliner





          # Python 3
          import urllib, os
          url = urllib.parse.urljoin('file:', urllib.request.pathname2url(os.path.abspath("service.xml")))


          This is a more complete one liner that will:




          • let you specify just the local path,

          • get you the absolute path,

          • and then format it as a file-url.


          Based upon:




          • the comments in the accepted answer and

          • this https://stackoverflow.com/a/14298190/622276

          • and thanks to user Sebastian the updated Python 3 implementation since we should avoid writing legacy python at this time.


          Original for reference





          # Python 2 (Legacy Python)
          import urlparse, urllib, os

          url = urlparse.urljoin('file:', urllib.pathname2url(os.path.abspath("service.xml")))





          share|improve this answer



















          • 1




            In case someone is using python3, the names have changed: import urllib, os url = urllib.parse.urljoin('file:', urllib.request.pathname2url(os.path.abspath("service.xml")))
            – Sebastian
            Jul 1 '17 at 9:51


















          14














          Oneliner





          # Python 3
          import urllib, os
          url = urllib.parse.urljoin('file:', urllib.request.pathname2url(os.path.abspath("service.xml")))


          This is a more complete one liner that will:




          • let you specify just the local path,

          • get you the absolute path,

          • and then format it as a file-url.


          Based upon:




          • the comments in the accepted answer and

          • this https://stackoverflow.com/a/14298190/622276

          • and thanks to user Sebastian the updated Python 3 implementation since we should avoid writing legacy python at this time.


          Original for reference





          # Python 2 (Legacy Python)
          import urlparse, urllib, os

          url = urlparse.urljoin('file:', urllib.pathname2url(os.path.abspath("service.xml")))





          share|improve this answer



















          • 1




            In case someone is using python3, the names have changed: import urllib, os url = urllib.parse.urljoin('file:', urllib.request.pathname2url(os.path.abspath("service.xml")))
            – Sebastian
            Jul 1 '17 at 9:51
















          14












          14








          14






          Oneliner





          # Python 3
          import urllib, os
          url = urllib.parse.urljoin('file:', urllib.request.pathname2url(os.path.abspath("service.xml")))


          This is a more complete one liner that will:




          • let you specify just the local path,

          • get you the absolute path,

          • and then format it as a file-url.


          Based upon:




          • the comments in the accepted answer and

          • this https://stackoverflow.com/a/14298190/622276

          • and thanks to user Sebastian the updated Python 3 implementation since we should avoid writing legacy python at this time.


          Original for reference





          # Python 2 (Legacy Python)
          import urlparse, urllib, os

          url = urlparse.urljoin('file:', urllib.pathname2url(os.path.abspath("service.xml")))





          share|improve this answer














          Oneliner





          # Python 3
          import urllib, os
          url = urllib.parse.urljoin('file:', urllib.request.pathname2url(os.path.abspath("service.xml")))


          This is a more complete one liner that will:




          • let you specify just the local path,

          • get you the absolute path,

          • and then format it as a file-url.


          Based upon:




          • the comments in the accepted answer and

          • this https://stackoverflow.com/a/14298190/622276

          • and thanks to user Sebastian the updated Python 3 implementation since we should avoid writing legacy python at this time.


          Original for reference





          # Python 2 (Legacy Python)
          import urlparse, urllib, os

          url = urlparse.urljoin('file:', urllib.pathname2url(os.path.abspath("service.xml")))






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 13 '18 at 3:11

























          answered Feb 20 '15 at 2:11









          Josh Peak

          1,2131827




          1,2131827








          • 1




            In case someone is using python3, the names have changed: import urllib, os url = urllib.parse.urljoin('file:', urllib.request.pathname2url(os.path.abspath("service.xml")))
            – Sebastian
            Jul 1 '17 at 9:51
















          • 1




            In case someone is using python3, the names have changed: import urllib, os url = urllib.parse.urljoin('file:', urllib.request.pathname2url(os.path.abspath("service.xml")))
            – Sebastian
            Jul 1 '17 at 9:51










          1




          1




          In case someone is using python3, the names have changed: import urllib, os url = urllib.parse.urljoin('file:', urllib.request.pathname2url(os.path.abspath("service.xml")))
          – Sebastian
          Jul 1 '17 at 9:51






          In case someone is using python3, the names have changed: import urllib, os url = urllib.parse.urljoin('file:', urllib.request.pathname2url(os.path.abspath("service.xml")))
          – Sebastian
          Jul 1 '17 at 9:51




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f4046628%2fis-it-possible-to-use-python-suds-to-read-a-wsdl-file-from-the-file-system%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Bressuire

          Vorschmack

          Quarantine