You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scout-dev@ws.apache.org by "Lin Sun (JIRA)" <sc...@ws.apache.org> on 2007/05/01 07:23:15 UTC

[jira] Commented: (SCOUT-29) AuthTokenImpl.getAuthInfo() doesn't seem to work correctly

    [ https://issues.apache.org/jira/browse/SCOUT-29?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492837 ] 

Lin Sun commented on SCOUT-29:
------------------------------

Hi Kurt, prob 1 still exists.  I was running the test in geronimo env.

Basically, the client sends the following request:

<get_authToken userID="XXXX" cred="XXXX" xmlns="urn:uddi-org:api_v2"/> 

And the uddiResponse is like:

<authToken generic="2.0" operator="jUDDI.org">
  <authInfo>authToken:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX</authInfo>
</authToken> 

So I want to set the response's namespace in the RegistryImpl.java's execute(XmlObject uddiRequest, URI endPointURI) method.  I've tried different ways, but haven't gotten it work yet.

I tried to add the following in RegistryImpl.java, before the response is parsed to uddiResponse.

        response.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns", this.getUddiNamespace());

or 
        response.setAttribute("namespaceURI", this.getUddiNamespace());

Also tried to add the nanespace after the response is parsed to uddiResponse:

            XmlObject uddiResponse = XmlObject.Factory.parse(in);
    
            XmlCursor cursor = uddiResponse.newCursor();
            cursor.toStartDoc();
            cursor.toFirstChild();
            //set the namespace if it is empty
            if ("".equals(cursor.getName().getNamespaceURI())) {
                System.out.println("empty namespace URI");
                cursor.setName(new QName("urn:uddi-org:api_v2", cursor.getName().getLocalPart()));
                cursor.dispose();
            }

I do see the change to "<xml-fragment ..." after "((AuthTokenDocument) o).getAuthToken()" is called, but the xmlns value isn't there which caused getAuthInfo() return null.

Any ideas?  Thanks, Lin

> AuthTokenImpl.getAuthInfo() doesn't seem to work correctly
> ----------------------------------------------------------
>
>                 Key: SCOUT-29
>                 URL: https://issues.apache.org/jira/browse/SCOUT-29
>             Project: Scout
>          Issue Type: Bug
>          Components: Scout Implementation
>    Affects Versions: 1.0
>         Environment: Win XP + Sun 1.5 SDK, latest scout trunk.
>            Reporter: Lin Sun
>         Assigned To: Anil Saldhana
>             Fix For: 1.0
>
>         Attachments: TestScout.java
>
>
> I created a simple test case to demonstrate the prob.  Basically, the test case would read a file and parse it to uddiResponse, then the code changes the uddiResponse to AuthToken type.  Then the code calls AuthTokenImpl.getAuthInfo() but that returned null.
> The content of uddiresponse.xml file is captured value of uddiResponse via a debugger of another test in the execute(XmlObject uddiRequest, URI endPointURI) method in RegistryImpl.java:
> <authToken generic="2.0" operator="jUDDI.org">
>   <authInfo>authToken:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX</authInfo>
> </authToken> 
> When the code calls for AuthTokenImpl.getAuthInfo(), it calls find_element_user(AUTHINFO$0, 0).  This won't find anything because 
> 1) the namespace isn't right in the uddiresponse.xml.  So I updated the file a bit:
> <authToken xmlns="urn:uddi-org:api_v2">
>   <authInfo>authToken:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX</authInfo>
> </authToken> 
> This can be possibly fixed by set the response's namespace in the execute(XmlObject uddiRequest, URI endPointURI) method and I'll try working on that.
> 2) the find_element_user (in XObj.java) won't be able to travel to the authInfo tag because the x._nextSibling is null.  (x._firstChild is the authInfo).
> here's the exerpt of the code from xmlbeans:
>     public TypeStoreUser find_element_user ( QName name, int i )
>     {
>         for ( Xobj x = _firstChild ; x != null ; x = x._nextSibling )
>             if (x.isElem() && x._name.equals( name ) && --i < 0)
>                 return x.getUser();
>         return null;
>     }
> I tried to change the following from
>     private static final javax.xml.namespace.QName AUTHINFO$0 = 
>         new javax.xml.namespace.QName("urn:uddi-org:api_v2", "authInfo");
> to
>     private static final javax.xml.namespace.QName AUTHINFO$0 = 
>         new javax.xml.namespace.QName("urn:uddi-org:api_v2", "authToken");
> and i was able to get the "authToken:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX" returned when I call AuthTokenImpl.getAuthInfo().   However, the AuthTokenImpl.java is generated so I don't know how to modify it.
> Any comments/advise?  Thanks, Lin

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: scout-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: scout-dev-help@ws.apache.org