3 Replies Latest reply on Sep 5, 2013 8:41 AM by Jim Wilson

    Error while consuming BBSA web service in .Net code

      Hi All,

      I am using BBSA 8.2. when I am adding the URL to consume the BBSA web services in my .Net code, I am getting the following error:

      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      The document at the url https://x.x.x.x:9843/services/BSALoginService.wsdl?= was not recognized as a known document type.

      The error message from each known type may help you fix the problem:

      - Report from 'DISCO Document' is 'Discovery document at the URL https://x.x.x.x:9843/services/BSALoginService.wsdl?= could not be found.'.

        - The document format is not recognized.

      - Report from 'WSDL Document' is 'There is an error in XML document (25, 5).'.

        - The element was not expected in this context: <wsdl:documentation xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'>..</wsdl:documentation>. Expected elements: http://www.w3.org/2001/XMLSchema:include, http://www.w3.org/2001/XMLSchema:import, http://www.w3.org/2001/XMLSchema:redefine, http://www.w3.org/2001/XMLSchema:simpleType, http://www.w3.org/2001/XMLSchema:complexType, http://www.w3.org/2001/XMLSchema:annotation, http://www.w3.org/2001/XMLSchema:notation, http://www.w3.org/2001/XMLSchema:group, http://www.w3.org/2001/XMLSchema:element, http://www.w3.org/2001/XMLSchema:attribute, http://www.w3.org/2001/XMLSchema:attributeGroup.

      - Report from 'XML Schema' is 'The root element of a W3C XML Schema should be <schema> and its namespace should be 'http://www.w3.org/2001/XMLSchema'.'.

      Metadata contains a reference that cannot be resolved: 'https://x.x.x.x:9843/services/BSALoginService.wsdl?='.

      Metadata contains a reference that cannot be resolved: 'https://x.x.x.x:9843/services/BSALoginService.wsdl?='.

      If the service is defined in the current solution, try building the solution and adding the service reference again.

      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

       

      Need help on how to resolve this.

      Thanks a lot in advance.

        • 1. Re: Error while consuming BBSA web service in .Net code
          Barry McQuillan

          I have encountered this before but it was using C#.

           

          There is no way to consume the URI directly into Visual Studio.

          There are 2 issues preventing:

          1. xs:schema document entries were incorrectly formatted

          2. Visual Studio doesn't follow wsdl:document standard exactly (standard allows documentation anywhere)

           

          The solution was:

          1. Save the URI as an XML document.

          2. Edit the file as per below:

          All documentation entries inside
          <xs:schema> should be in this format:

          <xs:annotation>

          <xs:documentation>              
          SessionCredentialExpiredException is thrown when a request is made by a user whose session has expired.

          In this case, the user should log in again.            

          </xs:documentation>

          </xs:annotation>           

           

          And not :

          <wsdl:documentation>

          SessionCredentialExpiredException is thrown when a request is made by a user whose session has expired.

          In this case, the user should log in again.

          </wsdl:documentation>

           

          For the <wsdl:documentation> elements I found the following :

          Working element

          <wsdl:service>

          <wsdl:documentation>

          </wsdl:documentation>

          </wsdl:service>

           

          However the remaining elements both fail and I had to comment out or remove them from the file:

          Failed elements

          <wsdl:definitions>

          <wsdl:documentation>

          </wsdl:documentation>

          </wsdl:definitions>

           

          And

          <wsdl:binding>

          <wsdl:documentation>

          </wsdl:documentation>

          </wsdl:binding>

           

          Once the <xs:schema> elements were corrected Visual Studio correctly built the  C# class objects from the wsdl file.

          Note: The Visual studio Command line wsdl.exe command still reported invalid elements for the failing 2
          wsdl objects, however these don’t appear to stop VS from building the class
          objects.

          • 2. Re: Error while consuming BBSA web service in .Net code

            I ran into a problem consuming the service directly from VS as well (VS 2012 w/ C#, BSA 8.2 sp3). I ended up using wsdl.exe to generate the proxy classes and then added those into my solution.

             

            I also had to remove some duplicate properties from 2/3 of the proxy classes as these were all setup in the same namespace. I don't recall what those properties were off hand though.

             

            Don't forget to add the certificate locally where you are developing, and also wherever this will run, since the WS are under HTTPS.

            • 3. Re: Error while consuming BBSA web service in .Net code
              Jim Wilson

              Hi pankaj NameToUpdate

               

              Were the responses helpful or correct?

              Please come to the community and mark them accordingly or let us know what else you need.

               

              Thanks & Regards,

              Jim