Frage

Ich arbeite an einem benutzerdefinierten Authentifizierungsanbieter für Cognos. Wir haben einen Webservice, der auf Authentifizierungsanfragen wartet. Zu Testzwecken versuche ich nur, einen Benutzer / Pass zu senden (wird später geändert, um Sitzungsinformationen zu verwenden).

Ich habe versucht, einen POC in einer einfachen Java-Konsolen-App zum Laufen zu bringen, bevor ich den benutzerdefinierten Anbieter implementiert habe. Ich habe Probleme, den Client dazu zu bringen, mit dem Webdienst zu kommunizieren. Ich habe den wsimport verwendet, um meine Klassen mit dem Keep-Flag zu generieren. Ich habe die generierten Java-Dateien in mein Eclipse-Projekt aufgenommen und eine Hauptmethode wie folgt erstellt:

CognosAuthentication service = new CognosAuthentication();

CognosAuthenticationSoap soapClient = service.getCognosAuthenticationSoap();

CognosUser user = soapClient.validateDevSession("username", "password");

System.out.println(user == null ? "User was null" : user.getUserName());

Ich habe versucht, auch die URL für den Dienst anzugeben (beide mit '? wsdl' am Ende und nicht):

CognosAuthentication service = new CognosAuthentication(new URL("http://somehost/CognosAuthentication.asmx"), new QName("http://tempuri.org/", "CognosAuthentication"));

Wo ist die WSDL, die vom Dienst generiert wird:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s1="http://www.ourcompany.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
      <s:import namespace="http://www.ourcompany.com/" />
      <s:element name="ValidateSession">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="username" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="expires" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="userId" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="authToken" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="ValidateSessionResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" ref="s1:ValidateSessionResult" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="ValidateDevSession">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="username" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="ValidateDevSessionResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" ref="s1:ValidateDevSessionResult" />
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
    <s:schema elementFormDefault="qualified" targetNamespace="http://www.ourcompany.com/">
      <s:element name="ValidateSessionResult" nillable="true" type="s1:CognosUser" />
      <s:complexType name="CognosUser">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="CognosSlot" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="GroupName" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string" />
        </s:sequence>
      </s:complexType>
      <s:element name="ValidateDevSessionResult" nillable="true" type="s1:CognosUser" />
    </s:schema>
  </wsdl:types>
  <wsdl:message name="ValidateSessionSoapIn">
    <wsdl:part name="parameters" element="tns:ValidateSession" />
  </wsdl:message>
  <wsdl:message name="ValidateSessionSoapOut">
    <wsdl:part name="parameters" element="tns:ValidateSessionResponse" />
  </wsdl:message>
  <wsdl:message name="ValidateDevSessionSoapIn">
    <wsdl:part name="parameters" element="tns:ValidateDevSession" />
  </wsdl:message>
  <wsdl:message name="ValidateDevSessionSoapOut">
    <wsdl:part name="parameters" element="tns:ValidateDevSessionResponse" />
  </wsdl:message>
  <wsdl:portType name="CognosAuthenticationSoap">
    <wsdl:operation name="ValidateSession">
      <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Gets user information based on the authentication token</wsdl:documentation>
      <wsdl:input message="tns:ValidateSessionSoapIn" />
      <wsdl:output message="tns:ValidateSessionSoapOut" />
    </wsdl:operation>
    <wsdl:operation name="ValidateDevSession">
      <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Gets user information based on the authentication token</wsdl:documentation>
      <wsdl:input message="tns:ValidateDevSessionSoapIn" />
      <wsdl:output message="tns:ValidateDevSessionSoapOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="CognosAuthenticationSoap" type="tns:CognosAuthenticationSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="ValidateSession">
      <soap:operation soapAction="http://tempuri.org/ValidateSession" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="ValidateDevSession">
      <soap:operation soapAction="http://tempuri.org/ValidDevSession" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="CognosAuthenticationSoap12" type="tns:CognosAuthenticationSoap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="ValidateSession">
      <soap12:operation soapAction="http://tempuri.org/ValidateSession" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="ValidateDevSession">
      <soap12:operation soapAction="http://tempuri.org/ValidDevSession" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="CognosAuthentication">
    <wsdl:port name="CognosAuthenticationSoap" binding="tns:CognosAuthenticationSoap">
      <soap:address location="http://mbeard2/LMS/app/analytics/CognosAuthentication.asmx" />
    </wsdl:port>
    <wsdl:port name="CognosAuthenticationSoap12" binding="tns:CognosAuthenticationSoap12">
      <soap12:address location="http://mbeard2/LMS/app/analytics/CognosAuthentication.asmx" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Ich gehe davon aus, dass ich mit wsimport alle richtigen Schritte ausgeführt habe. Das Problem, mit dem ich konfrontiert bin, ist, dass es nie etwas tut. Ich kann Fiddler starten und beobachten, dass kein Netzwerkverkehr auftritt. Das user -Objekt ist immer null. Muss ich etwas konfigurieren? Gibt es etwas Seltsames daran, dass der Webservice ein C # / ASP.NET-Dienst ist? Fehlt mir etwas in der Verwendung der SOAP-Anforderungsstruktur?

Ich erhalte weder beim Kompilieren noch beim Ausführen des Codes Fehler. Ich kratzte mir am Kopf nach Antworten!

War es hilfreich?

Lösung

SO benötigt die Option "Frage schließen, weil ich ein Trottel bin".Irgendwie nahm der Geiger die Anfrage nicht auf.Ich habe ein Remote-Debug mit dem Webservice verbunden und sah, dass die Anfrage einging und rausgeschmissen wurde, weil ich das Passwort falsch eingegeben hatte.Na ja ...

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top