[AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20

Robert Seletsky

I have the following Java method using AXIOM 1.2.13:

private OMElement createSecurityHeader(String username, String password) {
OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX);
OMFactory factory = new SOAP11Factory();
OMElementImpl securityHeader;
OMElementImpl usernameTokenElement;
OMElementImpl usernameElement;
OMElementImpl passwordElement;

// create the Security header block
securityHeader = new OMElementImpl("Security", wsseNS, factory);
securityHeader.addAttribute("mustUnderstand", "1", null);

// nest the UsernameToken in the Security header
usernameTokenElement = new OMElementImpl(USERNAME_TOKEN_LN, wsseNS, securityHeader, factory);

// nest the Username and Password elements
usernameElement = new OMElementImpl(USERNAME_LN, wsseNS, usernameTokenElement, factory);
usernameElement.setText(username);

passwordElement = new OMElementImpl(PASSWORD_LN, wsseNS,usernameTokenElement, factory);
passwordElement.setText(password);
passwordElement.addAttribute(PASSWORD_TYPE_ATTR, PASSWORD_TEXT, null);

return securityHeader;
}
}
I want to migrate this code to work with AXIOM 1.2.20.

Looking for a solution and what resources are recommended to do this in general?


Robert
University of New Mexico IT


Reply | Threaded
Open this post in threaded view
|

Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20

Andreas Veithen
Use OMAbstractFactory.getSOAP11Factory() to get the SOAPFactory instance, then rewrite your code to use the factory methods until there are no more references to internal implementation classes. The resulting code will then work with both Axiom versions.

Andreas


On Sep 7, 2017 4:46 PM, "Robert Seletsky" <[hidden email]> wrote:

I have the following Java method using AXIOM 1.2.13:

private OMElement createSecurityHeader(String username, String password) {
OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX);
OMFactory factory = new SOAP11Factory();
OMElementImpl securityHeader;
OMElementImpl usernameTokenElement;
OMElementImpl usernameElement;
OMElementImpl passwordElement;

// create the Security header block
securityHeader = new OMElementImpl("Security", wsseNS, factory);
securityHeader.addAttribute("mustUnderstand", "1", null);

// nest the UsernameToken in the Security header
usernameTokenElement = new OMElementImpl(USERNAME_TOKEN_LN, wsseNS, securityHeader, factory);

// nest the Username and Password elements
usernameElement = new OMElementImpl(USERNAME_LN, wsseNS, usernameTokenElement, factory);
usernameElement.setText(username);

passwordElement = new OMElementImpl(PASSWORD_LN, wsseNS,usernameTokenElement, factory);
passwordElement.setText(password);
passwordElement.addAttribute(PASSWORD_TYPE_ATTR, PASSWORD_TEXT, null);

return securityHeader;
}
}
I want to migrate this code to work with AXIOM 1.2.20.

Looking for a solution and what resources are recommended to do this in general?


Robert
University of New Mexico IT



Reply | Threaded
Open this post in threaded view
|

Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20

Robert Seletsky

Thank You Andreas!

So far I have:

private OMElement createSecurityHeader(String username, String password) {

//OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX);
SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
OMNamespace namespaceWSSE = factory.createOMNamespace(WSSE_NS, WSSE_PREFIX);
SOAPEnvelope envelope = factory.getDefaultEnvelope();
//OMFactory factory = new SOAP11Factory();


// create the Security header block
//securityHeader = new OMElementImpl("Security", wsseNS, factory);
OMElement element = factory.createOMElement("Security", namespaceWSSE);
OMAttribute attribute = factory.createOMAttribute("mustUnderstand",
null, "1");
element.addAttribute(attribute);
Unsure how to store this in 'envelope'


Also what weblinks or books do you recommend?


Robert


From: Andreas Veithen <[hidden email]>
Sent: Thursday, September 7, 2017 11:52:55 AM
To: [hidden email]
Subject: Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20
 
Use OMAbstractFactory.getSOAP11Factory() to get the SOAPFactory instance, then rewrite your code to use the factory methods until there are no more references to internal implementation classes. The resulting code will then work with both Axiom versions.

Andreas


On Sep 7, 2017 4:46 PM, "Robert Seletsky" <[hidden email]> wrote:

I have the following Java method using AXIOM 1.2.13:

private OMElement createSecurityHeader(String username, String password) {
OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX);
OMFactory factory = new SOAP11Factory();
OMElementImpl securityHeader;
OMElementImpl usernameTokenElement;
OMElementImpl usernameElement;
OMElementImpl passwordElement;

// create the Security header block
securityHeader = new OMElementImpl("Security", wsseNS, factory);
securityHeader.addAttribute("mustUnderstand", "1", null);

// nest the UsernameToken in the Security header
usernameTokenElement = new OMElementImpl(USERNAME_TOKEN_LN, wsseNS, securityHeader, factory);

// nest the Username and Password elements
usernameElement = new OMElementImpl(USERNAME_LN, wsseNS, usernameTokenElement, factory);
usernameElement.setText(username);

passwordElement = new OMElementImpl(PASSWORD_LN, wsseNS,usernameTokenElement, factory);
passwordElement.setText(password);
passwordElement.addAttribute(PASSWORD_TYPE_ATTR, PASSWORD_TEXT, null);

return securityHeader;
}
}
I want to migrate this code to work with AXIOM 1.2.20.

Looking for a solution and what resources are recommended to do this in general?


Robert
University of New Mexico IT



Reply | Threaded
Open this post in threaded view
|

Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20

Andreas Veithen
On Thu, Sep 7, 2017 at 9:59 PM, Robert Seletsky <[hidden email]> wrote:

> Thank You Andreas!
>
> So far I have:
>
> private OMElement createSecurityHeader(String username, String password) {
>
> //OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX);
> SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
> OMNamespace namespaceWSSE = factory.createOMNamespace(WSSE_NS, WSSE_PREFIX);
> SOAPEnvelope envelope = factory.getDefaultEnvelope();
> //OMFactory factory = new SOAP11Factory();
>
>
> // create the Security header block
> //securityHeader = new OMElementImpl("Security", wsseNS, factory);
> OMElement element = factory.createOMElement("Security", namespaceWSSE);
> OMAttribute attribute = factory.createOMAttribute("mustUnderstand",
>       null, "1");
> element.addAttribute(attribute);
>
> Unsure how to store this in 'envelope'

I don't understand. The original code has no reference to an envelope at all.

> Also what weblinks or books do you recommend?

http://ws.apache.org/axiom/

>
>
> Robert
>
> ________________________________
> From: Andreas Veithen <[hidden email]>
> Sent: Thursday, September 7, 2017 11:52:55 AM
> To: [hidden email]
> Subject: Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20
>
> Use OMAbstractFactory.getSOAP11Factory() to get the SOAPFactory instance,
> then rewrite your code to use the factory methods until there are no more
> references to internal implementation classes. The resulting code will then
> work with both Axiom versions.
>
> Andreas
>
>
> On Sep 7, 2017 4:46 PM, "Robert Seletsky" <[hidden email]> wrote:
>
> I have the following Java method using AXIOM 1.2.13:
>
> private OMElement createSecurityHeader(String username, String password) {
>       OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX);
>       OMFactory factory = new SOAP11Factory();
>       OMElementImpl securityHeader;
>       OMElementImpl usernameTokenElement;
>       OMElementImpl usernameElement;
>       OMElementImpl passwordElement;
>
>       // create the Security header block
>       securityHeader = new OMElementImpl("Security", wsseNS, factory);
>       securityHeader.addAttribute("mustUnderstand", "1", null);
>
>       // nest the UsernameToken in the Security header
>       usernameTokenElement = new OMElementImpl(USERNAME_TOKEN_LN, wsseNS,
> securityHeader, factory);
>
>       // nest the Username and Password elements
>       usernameElement = new OMElementImpl(USERNAME_LN, wsseNS,
> usernameTokenElement, factory);
>       usernameElement.setText(username);
>
>       passwordElement = new OMElementImpl(PASSWORD_LN,
> wsseNS,usernameTokenElement, factory);
>       passwordElement.setText(password);
>       passwordElement.addAttribute(PASSWORD_TYPE_ATTR, PASSWORD_TEXT, null);
>
>       return securityHeader;
>    }
> }
>
> I want to migrate this code to work with AXIOM 1.2.20.
>
> Looking for a solution and what resources are recommended to do this in
> general?
>
>
> Robert
> University of New Mexico IT
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20

Robert Seletsky

Thank you Andreas!

Now have:

private OMElement createSecurityHeader(String username, String password) {
SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
OMNamespace namespaceWSSE = factory.createOMNamespace(WSSE_NS, WSSE_PREFIX);

// create the Security header block
OMElement securityHeader = factory.createOMElement("Security", namespaceWSSE);
OMAttribute attribute = factory.createOMAttribute("mustUnderstand",
null, "1");
securityHeader.addAttribute(attribute);

// nest the UsernameToken in the Security header
OMElement usernameTokenElement = factory.createOMElement(USERNAME_TOKEN_LN, namespaceWSSE);
securityHeader.addChild(usernameTokenElement);

// nest the Username and Password elements
OMElement usernameElement = factory.createOMElement(USERNAME_LN, namespaceWSSE);
usernameElement.setText(username);
securityHeader.addChild(usernameElement);

OMElement passwordElement = factory.createOMElement(PASSWORD_LN, namespaceWSSE);
passwordElement.setText(password);
OMAttribute attributep = factory.createOMAttribute(PASSWORD_TYPE_ATTR,
null, PASSWORD_TEXT);
securityHeader.addAttribute(attributep);
securityHeader.addChild(passwordElement);

return securityHeader;
}
}
But, stepping through original code (Axiom 1.2.13) and the above code (Axiom 1.2.20), I can see that the original has nested 'FirstChild' structures and the above code does not.

I have looked at http://ws.apache.org/axiom/ , but having difficulty.


Robert

From: Andreas Veithen <[hidden email]>
Sent: Friday, September 8, 2017 4:48:49 PM
To: [hidden email]
Subject: Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20
 
On Thu, Sep 7, 2017 at 9:59 PM, Robert Seletsky <[hidden email]> wrote:
> Thank You Andreas!
>
> So far I have:
>
> private OMElement createSecurityHeader(String username, String password) {
>
> //OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX);
> SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
> OMNamespace namespaceWSSE = factory.createOMNamespace(WSSE_NS, WSSE_PREFIX);
> SOAPEnvelope envelope = factory.getDefaultEnvelope();
> //OMFactory factory = new SOAP11Factory();
>
>
> // create the Security header block
> //securityHeader = new OMElementImpl("Security", wsseNS, factory);
> OMElement element = factory.createOMElement("Security", namespaceWSSE);
> OMAttribute attribute = factory.createOMAttribute("mustUnderstand",
>       null, "1");
> element.addAttribute(attribute);
>
> Unsure how to store this in 'envelope'

I don't understand. The original code has no reference to an envelope at all.

> Also what weblinks or books do you recommend?

http://ws.apache.org/axiom/

>
>
> Robert
>
> ________________________________
> From: Andreas Veithen <[hidden email]>
> Sent: Thursday, September 7, 2017 11:52:55 AM
> To: [hidden email]
> Subject: Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20
>
> Use OMAbstractFactory.getSOAP11Factory() to get the SOAPFactory instance,
> then rewrite your code to use the factory methods until there are no more
> references to internal implementation classes. The resulting code will then
> work with both Axiom versions.
>
> Andreas
>
>
> On Sep 7, 2017 4:46 PM, "Robert Seletsky" <[hidden email]> wrote:
>
> I have the following Java method using AXIOM 1.2.13:
>
> private OMElement createSecurityHeader(String username, String password) {
>       OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX);
>       OMFactory factory = new SOAP11Factory();
>       OMElementImpl securityHeader;
>       OMElementImpl usernameTokenElement;
>       OMElementImpl usernameElement;
>       OMElementImpl passwordElement;
>
>       // create the Security header block
>       securityHeader = new OMElementImpl("Security", wsseNS, factory);
>       securityHeader.addAttribute("mustUnderstand", "1", null);
>
>       // nest the UsernameToken in the Security header
>       usernameTokenElement = new OMElementImpl(USERNAME_TOKEN_LN, wsseNS,
> securityHeader, factory);
>
>       // nest the Username and Password elements
>       usernameElement = new OMElementImpl(USERNAME_LN, wsseNS,
> usernameTokenElement, factory);
>       usernameElement.setText(username);
>
>       passwordElement = new OMElementImpl(PASSWORD_LN,
> wsseNS,usernameTokenElement, factory);
>       passwordElement.setText(password);
>       passwordElement.addAttribute(PASSWORD_TYPE_ATTR, PASSWORD_TEXT, null);
>
>       return securityHeader;
>    }
> }
>
> I want to migrate this code to work with AXIOM 1.2.20.
>
> Looking for a solution and what resources are recommended to do this in
> general?
>
>
> Robert
> University of New Mexico IT
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20

Andreas Veithen
On Mon, Sep 11, 2017 at 10:09 PM, Robert Seletsky <[hidden email]> wrote:

> Thank you Andreas!
>
> Now have:
>
> private OMElement createSecurityHeader(String username, String password) {
>       SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
>       OMNamespace namespaceWSSE = factory.createOMNamespace(WSSE_NS,
> WSSE_PREFIX);
>
>       // create the Security header block
>       OMElement securityHeader = factory.createOMElement("Security",
> namespaceWSSE);
>       OMAttribute attribute = factory.createOMAttribute("mustUnderstand",
>             null, "1");
>       securityHeader.addAttribute(attribute);
>
>       // nest the UsernameToken in the Security header
>       OMElement usernameTokenElement =
> factory.createOMElement(USERNAME_TOKEN_LN, namespaceWSSE);
>       securityHeader.addChild(usernameTokenElement);
>
>       // nest the Username and Password elements
>       OMElement usernameElement = factory.createOMElement(USERNAME_LN,
> namespaceWSSE);
>       usernameElement.setText(username);
>       securityHeader.addChild(usernameElement);
>
>       OMElement passwordElement = factory.createOMElement(PASSWORD_LN,
> namespaceWSSE);
>       passwordElement.setText(password);
>       OMAttribute attributep = factory.createOMAttribute(PASSWORD_TYPE_ATTR,
>             null, PASSWORD_TEXT);
>       securityHeader.addAttribute(attributep);
>       securityHeader.addChild(passwordElement);
>
>       return securityHeader;
>    }
> }
>
> But, stepping through original code (Axiom 1.2.13) and the above code (Axiom
> 1.2.20), I can see that the original has nested 'FirstChild' structures and
> the above code does not.

Sorry, but I don't understand what "nested 'FirstChild' structures" means.

>
> I have looked at http://ws.apache.org/axiom/ , but having difficulty.
>
>
> Robert
> ________________________________
> From: Andreas Veithen <[hidden email]>
> Sent: Friday, September 8, 2017 4:48:49 PM
>
> To: [hidden email]
> Subject: Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20
>
> On Thu, Sep 7, 2017 at 9:59 PM, Robert Seletsky <[hidden email]> wrote:
>> Thank You Andreas!
>>
>> So far I have:
>>
>> private OMElement createSecurityHeader(String username, String password) {
>>
>> //OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX);
>> SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
>> OMNamespace namespaceWSSE = factory.createOMNamespace(WSSE_NS,
>> WSSE_PREFIX);
>> SOAPEnvelope envelope = factory.getDefaultEnvelope();
>> //OMFactory factory = new SOAP11Factory();
>>
>>
>> // create the Security header block
>> //securityHeader = new OMElementImpl("Security", wsseNS, factory);
>> OMElement element = factory.createOMElement("Security", namespaceWSSE);
>> OMAttribute attribute = factory.createOMAttribute("mustUnderstand",
>>       null, "1");
>> element.addAttribute(attribute);
>>
>> Unsure how to store this in 'envelope'
>
> I don't understand. The original code has no reference to an envelope at
> all.
>
>> Also what weblinks or books do you recommend?
>
> http://ws.apache.org/axiom/
>
>>
>>
>> Robert
>>
>> ________________________________
>> From: Andreas Veithen <[hidden email]>
>> Sent: Thursday, September 7, 2017 11:52:55 AM
>> To: [hidden email]
>> Subject: Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20
>>
>> Use OMAbstractFactory.getSOAP11Factory() to get the SOAPFactory instance,
>> then rewrite your code to use the factory methods until there are no more
>> references to internal implementation classes. The resulting code will
>> then
>> work with both Axiom versions.
>>
>> Andreas
>>
>>
>> On Sep 7, 2017 4:46 PM, "Robert Seletsky" <[hidden email]> wrote:
>>
>> I have the following Java method using AXIOM 1.2.13:
>>
>> private OMElement createSecurityHeader(String username, String password) {
>>       OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX);
>>       OMFactory factory = new SOAP11Factory();
>>       OMElementImpl securityHeader;
>>       OMElementImpl usernameTokenElement;
>>       OMElementImpl usernameElement;
>>       OMElementImpl passwordElement;
>>
>>       // create the Security header block
>>       securityHeader = new OMElementImpl("Security", wsseNS, factory);
>>       securityHeader.addAttribute("mustUnderstand", "1", null);
>>
>>       // nest the UsernameToken in the Security header
>>       usernameTokenElement = new OMElementImpl(USERNAME_TOKEN_LN, wsseNS,
>> securityHeader, factory);
>>
>>       // nest the Username and Password elements
>>       usernameElement = new OMElementImpl(USERNAME_LN, wsseNS,
>> usernameTokenElement, factory);
>>       usernameElement.setText(username);
>>
>>       passwordElement = new OMElementImpl(PASSWORD_LN,
>> wsseNS,usernameTokenElement, factory);
>>       passwordElement.setText(password);
>>       passwordElement.addAttribute(PASSWORD_TYPE_ATTR, PASSWORD_TEXT,
>> null);
>>
>>       return securityHeader;
>>    }
>> }
>>
>> I want to migrate this code to work with AXIOM 1.2.20.
>>
>> Looking for a solution and what resources are recommended to do this in
>> general?
>>
>>
>> Robert
>> University of New Mexico IT
>>
>>
>>
Reply | Threaded
Open this post in threaded view
|

Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20

Robert Seletsky

Hello Andreas,

  "nested 'FirstChild' structures" means the original code 'securityHeader' via debugger looks like:

securityHeader

localName = "Security"

firstChild

localName="Username Token"

firstChild

localName="Username"

firstChild

value="..."

nextSibling

localName="Password"

firstChild

value="###"


Robert

From: Andreas Veithen <[hidden email]>
Sent: Monday, September 11, 2017 4:25:31 PM
To: [hidden email]
Subject: Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20
 
On Mon, Sep 11, 2017 at 10:09 PM, Robert Seletsky <[hidden email]> wrote:
> Thank you Andreas!
>
> Now have:
>
> private OMElement createSecurityHeader(String username, String password) {
>       SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
>       OMNamespace namespaceWSSE = factory.createOMNamespace(WSSE_NS,
> WSSE_PREFIX);
>
>       // create the Security header block
>       OMElement securityHeader = factory.createOMElement("Security",
> namespaceWSSE);
>       OMAttribute attribute = factory.createOMAttribute("mustUnderstand",
>             null, "1");
>       securityHeader.addAttribute(attribute);
>
>       // nest the UsernameToken in the Security header
>       OMElement usernameTokenElement =
> factory.createOMElement(USERNAME_TOKEN_LN, namespaceWSSE);
>       securityHeader.addChild(usernameTokenElement);
>
>       // nest the Username and Password elements
>       OMElement usernameElement = factory.createOMElement(USERNAME_LN,
> namespaceWSSE);
>       usernameElement.setText(username);
>       securityHeader.addChild(usernameElement);
>
>       OMElement passwordElement = factory.createOMElement(PASSWORD_LN,
> namespaceWSSE);
>       passwordElement.setText(password);
>       OMAttribute attributep = factory.createOMAttribute(PASSWORD_TYPE_ATTR,
>             null, PASSWORD_TEXT);
>       securityHeader.addAttribute(attributep);
>       securityHeader.addChild(passwordElement);
>
>       return securityHeader;
>    }
> }
>
> But, stepping through original code (Axiom 1.2.13) and the above code (Axiom
> 1.2.20), I can see that the original has nested 'FirstChild' structures and
> the above code does not.

Sorry, but I don't understand what "nested 'FirstChild' structures" means.

>
> I have looked at http://ws.apache.org/axiom/ , but having difficulty.
>
>
> Robert
> ________________________________
> From: Andreas Veithen <[hidden email]>
> Sent: Friday, September 8, 2017 4:48:49 PM
>
> To: [hidden email]
> Subject: Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20
>
> On Thu, Sep 7, 2017 at 9:59 PM, Robert Seletsky <[hidden email]> wrote:
>> Thank You Andreas!
>>
>> So far I have:
>>
>> private OMElement createSecurityHeader(String username, String password) {
>>
>> //OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX);
>> SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
>> OMNamespace namespaceWSSE = factory.createOMNamespace(WSSE_NS,
>> WSSE_PREFIX);
>> SOAPEnvelope envelope = factory.getDefaultEnvelope();
>> //OMFactory factory = new SOAP11Factory();
>>
>>
>> // create the Security header block
>> //securityHeader = new OMElementImpl("Security", wsseNS, factory);
>> OMElement element = factory.createOMElement("Security", namespaceWSSE);
>> OMAttribute attribute = factory.createOMAttribute("mustUnderstand",
>>       null, "1");
>> element.addAttribute(attribute);
>>
>> Unsure how to store this in 'envelope'
>
> I don't understand. The original code has no reference to an envelope at
> all.
>
>> Also what weblinks or books do you recommend?
>
> http://ws.apache.org/axiom/
>
>>
>>
>> Robert
>>
>> ________________________________
>> From: Andreas Veithen <[hidden email]>
>> Sent: Thursday, September 7, 2017 11:52:55 AM
>> To: [hidden email]
>> Subject: Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20
>>
>> Use OMAbstractFactory.getSOAP11Factory() to get the SOAPFactory instance,
>> then rewrite your code to use the factory methods until there are no more
>> references to internal implementation classes. The resulting code will
>> then
>> work with both Axiom versions.
>>
>> Andreas
>>
>>
>> On Sep 7, 2017 4:46 PM, "Robert Seletsky" <[hidden email]> wrote:
>>
>> I have the following Java method using AXIOM 1.2.13:
>>
>> private OMElement createSecurityHeader(String username, String password) {
>>       OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX);
>>       OMFactory factory = new SOAP11Factory();
>>       OMElementImpl securityHeader;
>>       OMElementImpl usernameTokenElement;
>>       OMElementImpl usernameElement;
>>       OMElementImpl passwordElement;
>>
>>       // create the Security header block
>>       securityHeader = new OMElementImpl("Security", wsseNS, factory);
>>       securityHeader.addAttribute("mustUnderstand", "1", null);
>>
>>       // nest the UsernameToken in the Security header
>>       usernameTokenElement = new OMElementImpl(USERNAME_TOKEN_LN, wsseNS,
>> securityHeader, factory);
>>
>>       // nest the Username and Password elements
>>       usernameElement = new OMElementImpl(USERNAME_LN, wsseNS,
>> usernameTokenElement, factory);
>>       usernameElement.setText(username);
>>
>>       passwordElement = new OMElementImpl(PASSWORD_LN,
>> wsseNS,usernameTokenElement, factory);
>>       passwordElement.setText(password);
>>       passwordElement.addAttribute(PASSWORD_TYPE_ATTR, PASSWORD_TEXT,
>> null);
>>
>>       return securityHeader;
>>    }
>> }
>>
>> I want to migrate this code to work with AXIOM 1.2.20.
>>
>> Looking for a solution and what resources are recommended to do this in
>> general?
>>
>>
>> Robert
>> University of New Mexico IT
>>
>>
>>
Reply | Threaded
Open this post in threaded view
|

Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20

Andreas Veithen
These are implementation details that may change in new releases.

Andreas

On Tue, Sep 12, 2017 at 4:24 PM, Robert Seletsky <[hidden email]> wrote:

> Hello Andreas,
>
>   "nested 'FirstChild' structures" means the original code 'securityHeader'
> via debugger looks like:
>
> securityHeader
>
> localName = "Security"
>
> firstChild
>
> localName="Username Token"
>
> firstChild
>
> localName="Username"
>
> firstChild
>
> value="..."
>
> nextSibling
>
> localName="Password"
>
> firstChild
>
> value="###"
>
>
> Robert
> ________________________________
> From: Andreas Veithen <[hidden email]>
> Sent: Monday, September 11, 2017 4:25:31 PM
>
> To: [hidden email]
> Subject: Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20
>
> On Mon, Sep 11, 2017 at 10:09 PM, Robert Seletsky <[hidden email]> wrote:
>> Thank you Andreas!
>>
>> Now have:
>>
>> private OMElement createSecurityHeader(String username, String password) {
>>       SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
>>       OMNamespace namespaceWSSE = factory.createOMNamespace(WSSE_NS,
>> WSSE_PREFIX);
>>
>>       // create the Security header block
>>       OMElement securityHeader = factory.createOMElement("Security",
>> namespaceWSSE);
>>       OMAttribute attribute = factory.createOMAttribute("mustUnderstand",
>>             null, "1");
>>       securityHeader.addAttribute(attribute);
>>
>>       // nest the UsernameToken in the Security header
>>       OMElement usernameTokenElement =
>> factory.createOMElement(USERNAME_TOKEN_LN, namespaceWSSE);
>>       securityHeader.addChild(usernameTokenElement);
>>
>>       // nest the Username and Password elements
>>       OMElement usernameElement = factory.createOMElement(USERNAME_LN,
>> namespaceWSSE);
>>       usernameElement.setText(username);
>>       securityHeader.addChild(usernameElement);
>>
>>       OMElement passwordElement = factory.createOMElement(PASSWORD_LN,
>> namespaceWSSE);
>>       passwordElement.setText(password);
>>       OMAttribute attributep =
>> factory.createOMAttribute(PASSWORD_TYPE_ATTR,
>>             null, PASSWORD_TEXT);
>>       securityHeader.addAttribute(attributep);
>>       securityHeader.addChild(passwordElement);
>>
>>       return securityHeader;
>>    }
>> }
>>
>> But, stepping through original code (Axiom 1.2.13) and the above code
>> (Axiom
>> 1.2.20), I can see that the original has nested 'FirstChild' structures
>> and
>> the above code does not.
>
> Sorry, but I don't understand what "nested 'FirstChild' structures" means.
>
>>
>> I have looked at http://ws.apache.org/axiom/ , but having difficulty.
>>
>>
>> Robert
>> ________________________________
>> From: Andreas Veithen <[hidden email]>
>> Sent: Friday, September 8, 2017 4:48:49 PM
>>
>> To: [hidden email]
>> Subject: Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20
>>
>> On Thu, Sep 7, 2017 at 9:59 PM, Robert Seletsky <[hidden email]> wrote:
>>> Thank You Andreas!
>>>
>>> So far I have:
>>>
>>> private OMElement createSecurityHeader(String username, String password)
>>> {
>>>
>>> //OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX);
>>> SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
>>> OMNamespace namespaceWSSE = factory.createOMNamespace(WSSE_NS,
>>> WSSE_PREFIX);
>>> SOAPEnvelope envelope = factory.getDefaultEnvelope();
>>> //OMFactory factory = new SOAP11Factory();
>>>
>>>
>>> // create the Security header block
>>> //securityHeader = new OMElementImpl("Security", wsseNS, factory);
>>> OMElement element = factory.createOMElement("Security", namespaceWSSE);
>>> OMAttribute attribute = factory.createOMAttribute("mustUnderstand",
>>>       null, "1");
>>> element.addAttribute(attribute);
>>>
>>> Unsure how to store this in 'envelope'
>>
>> I don't understand. The original code has no reference to an envelope at
>> all.
>>
>>> Also what weblinks or books do you recommend?
>>
>> http://ws.apache.org/axiom/
>>
>>>
>>>
>>> Robert
>>>
>>> ________________________________
>>> From: Andreas Veithen <[hidden email]>
>>> Sent: Thursday, September 7, 2017 11:52:55 AM
>>> To: [hidden email]
>>> Subject: Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20
>>>
>>> Use OMAbstractFactory.getSOAP11Factory() to get the SOAPFactory instance,
>>> then rewrite your code to use the factory methods until there are no more
>>> references to internal implementation classes. The resulting code will
>>> then
>>> work with both Axiom versions.
>>>
>>> Andreas
>>>
>>>
>>> On Sep 7, 2017 4:46 PM, "Robert Seletsky" <[hidden email]> wrote:
>>>
>>> I have the following Java method using AXIOM 1.2.13:
>>>
>>> private OMElement createSecurityHeader(String username, String password)
>>> {
>>>       OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX);
>>>       OMFactory factory = new SOAP11Factory();
>>>       OMElementImpl securityHeader;
>>>       OMElementImpl usernameTokenElement;
>>>       OMElementImpl usernameElement;
>>>       OMElementImpl passwordElement;
>>>
>>>       // create the Security header block
>>>       securityHeader = new OMElementImpl("Security", wsseNS, factory);
>>>       securityHeader.addAttribute("mustUnderstand", "1", null);
>>>
>>>       // nest the UsernameToken in the Security header
>>>       usernameTokenElement = new OMElementImpl(USERNAME_TOKEN_LN, wsseNS,
>>> securityHeader, factory);
>>>
>>>       // nest the Username and Password elements
>>>       usernameElement = new OMElementImpl(USERNAME_LN, wsseNS,
>>> usernameTokenElement, factory);
>>>       usernameElement.setText(username);
>>>
>>>       passwordElement = new OMElementImpl(PASSWORD_LN,
>>> wsseNS,usernameTokenElement, factory);
>>>       passwordElement.setText(password);
>>>       passwordElement.addAttribute(PASSWORD_TYPE_ATTR, PASSWORD_TEXT,
>>> null);
>>>
>>>       return securityHeader;
>>>    }
>>> }
>>>
>>> I want to migrate this code to work with AXIOM 1.2.20.
>>>
>>> Looking for a solution and what resources are recommended to do this in
>>> general?
>>>
>>>
>>> Robert
>>> University of New Mexico IT
>>>
>>>
>>>
Reply | Threaded
Open this post in threaded view
|

Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20

Robert Seletsky

Thanks Andreas!

I believe I have successfully migrated this method.


Robert


From: Andreas Veithen <[hidden email]>
Sent: Tuesday, September 12, 2017 1:32:48 PM
To: [hidden email]
Subject: Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20
 
These are implementation details that may change in new releases.

Andreas

On Tue, Sep 12, 2017 at 4:24 PM, Robert Seletsky <[hidden email]> wrote:
> Hello Andreas,
>
>   "nested 'FirstChild' structures" means the original code 'securityHeader'
> via debugger looks like:
>
> securityHeader
>
> localName = "Security"
>
> firstChild
>
> localName="Username Token"
>
> firstChild
>
> localName="Username"
>
> firstChild
>
> value="..."
>
> nextSibling
>
> localName="Password"
>
> firstChild
>
> value="###"
>
>
> Robert
> ________________________________
> From: Andreas Veithen <[hidden email]>
> Sent: Monday, September 11, 2017 4:25:31 PM
>
> To: [hidden email]
> Subject: Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20
>
> On Mon, Sep 11, 2017 at 10:09 PM, Robert Seletsky <[hidden email]> wrote:
>> Thank you Andreas!
>>
>> Now have:
>>
>> private OMElement createSecurityHeader(String username, String password) {
>>       SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
>>       OMNamespace namespaceWSSE = factory.createOMNamespace(WSSE_NS,
>> WSSE_PREFIX);
>>
>>       // create the Security header block
>>       OMElement securityHeader = factory.createOMElement("Security",
>> namespaceWSSE);
>>       OMAttribute attribute = factory.createOMAttribute("mustUnderstand",
>>             null, "1");
>>       securityHeader.addAttribute(attribute);
>>
>>       // nest the UsernameToken in the Security header
>>       OMElement usernameTokenElement =
>> factory.createOMElement(USERNAME_TOKEN_LN, namespaceWSSE);
>>       securityHeader.addChild(usernameTokenElement);
>>
>>       // nest the Username and Password elements
>>       OMElement usernameElement = factory.createOMElement(USERNAME_LN,
>> namespaceWSSE);
>>       usernameElement.setText(username);
>>       securityHeader.addChild(usernameElement);
>>
>>       OMElement passwordElement = factory.createOMElement(PASSWORD_LN,
>> namespaceWSSE);
>>       passwordElement.setText(password);
>>       OMAttribute attributep =
>> factory.createOMAttribute(PASSWORD_TYPE_ATTR,
>>             null, PASSWORD_TEXT);
>>       securityHeader.addAttribute(attributep);
>>       securityHeader.addChild(passwordElement);
>>
>>       return securityHeader;
>>    }
>> }
>>
>> But, stepping through original code (Axiom 1.2.13) and the above code
>> (Axiom
>> 1.2.20), I can see that the original has nested 'FirstChild' structures
>> and
>> the above code does not.
>
> Sorry, but I don't understand what "nested 'FirstChild' structures" means.
>
>>
>> I have looked at http://ws.apache.org/axiom/ , but having difficulty.
>>
>>
>> Robert
>> ________________________________
>> From: Andreas Veithen <[hidden email]>
>> Sent: Friday, September 8, 2017 4:48:49 PM
>>
>> To: [hidden email]
>> Subject: Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20
>>
>> On Thu, Sep 7, 2017 at 9:59 PM, Robert Seletsky <[hidden email]> wrote:
>>> Thank You Andreas!
>>>
>>> So far I have:
>>>
>>> private OMElement createSecurityHeader(String username, String password)
>>> {
>>>
>>> //OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX);
>>> SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
>>> OMNamespace namespaceWSSE = factory.createOMNamespace(WSSE_NS,
>>> WSSE_PREFIX);
>>> SOAPEnvelope envelope = factory.getDefaultEnvelope();
>>> //OMFactory factory = new SOAP11Factory();
>>>
>>>
>>> // create the Security header block
>>> //securityHeader = new OMElementImpl("Security", wsseNS, factory);
>>> OMElement element = factory.createOMElement("Security", namespaceWSSE);
>>> OMAttribute attribute = factory.createOMAttribute("mustUnderstand",
>>>       null, "1");
>>> element.addAttribute(attribute);
>>>
>>> Unsure how to store this in 'envelope'
>>
>> I don't understand. The original code has no reference to an envelope at
>> all.
>>
>>> Also what weblinks or books do you recommend?
>>
>> http://ws.apache.org/axiom/
>>
>>>
>>>
>>> Robert
>>>
>>> ________________________________
>>> From: Andreas Veithen <[hidden email]>
>>> Sent: Thursday, September 7, 2017 11:52:55 AM
>>> To: [hidden email]
>>> Subject: Re: [AXIOM] Migrating Java code from AXIOM 1.2.13 to 1.2.20
>>>
>>> Use OMAbstractFactory.getSOAP11Factory() to get the SOAPFactory instance,
>>> then rewrite your code to use the factory methods until there are no more
>>> references to internal implementation classes. The resulting code will
>>> then
>>> work with both Axiom versions.
>>>
>>> Andreas
>>>
>>>
>>> On Sep 7, 2017 4:46 PM, "Robert Seletsky" <[hidden email]> wrote:
>>>
>>> I have the following Java method using AXIOM 1.2.13:
>>>
>>> private OMElement createSecurityHeader(String username, String password)
>>> {
>>>       OMNamespaceImpl wsseNS = new OMNamespaceImpl(WSSE_NS, WSSE_PREFIX);
>>>       OMFactory factory = new SOAP11Factory();
>>>       OMElementImpl securityHeader;
>>>       OMElementImpl usernameTokenElement;
>>>       OMElementImpl usernameElement;
>>>       OMElementImpl passwordElement;
>>>
>>>       // create the Security header block
>>>       securityHeader = new OMElementImpl("Security", wsseNS, factory);
>>>       securityHeader.addAttribute("mustUnderstand", "1", null);
>>>
>>>       // nest the UsernameToken in the Security header
>>>       usernameTokenElement = new OMElementImpl(USERNAME_TOKEN_LN, wsseNS,
>>> securityHeader, factory);
>>>
>>>       // nest the Username and Password elements
>>>       usernameElement = new OMElementImpl(USERNAME_LN, wsseNS,
>>> usernameTokenElement, factory);
>>>       usernameElement.setText(username);
>>>
>>>       passwordElement = new OMElementImpl(PASSWORD_LN,
>>> wsseNS,usernameTokenElement, factory);
>>>       passwordElement.setText(password);
>>>       passwordElement.addAttribute(PASSWORD_TYPE_ATTR, PASSWORD_TEXT,
>>> null);
>>>
>>>       return securityHeader;
>>>    }
>>> }
>>>
>>> I want to migrate this code to work with AXIOM 1.2.20.
>>>
>>> Looking for a solution and what resources are recommended to do this in
>>> general?
>>>
>>>
>>> Robert
>>> University of New Mexico IT
>>>
>>>
>>>