Question

I'm working on a custom authentication provider for Cognos. We have a webservice that will be listening for auth requests. For testing purposes I'm just trying to send a user/pass (will be changed later to use session information).

I've been trying to get a POC working in a simple Java console app before implementing the custom provider. I am having trouble getting the client to communicate with the web service. I used the wsimport to generate my classes using the keep flag. I brought the generated java files into my Eclipse project and built a main method like so:

CognosAuthentication service = new CognosAuthentication();

CognosAuthenticationSoap soapClient = service.getCognosAuthenticationSoap();

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

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

I've tried also specifying the URL for the service (both with '?wsdl' appended on the end and not):

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

Where is the WSDL that is generated by the service:

<?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>

I assume that I've done all the correct steps using wsimport. The issue that I am facing is that it never does anything. I can fire up fiddler and watch that no network traffic occurs. The user object always is null. Is there something that I need to configure? Is there something odd about the webservice being a C#/ASP.NET service? Am I missing something in how I'm using the SOAP request structure?

I'm not getting any errors during compilation nor when I run the code. I'm scratching my head for answers!

Was it helpful?

Solution

SO needs a "Close My Question Because I'm A Dunce" option. Somehow fiddler was not picking up on the request. I got a remote debug hooked up to the webservice and saw the request come in and get kicked out because I mistyped the password. Oh well...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top