Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Matthew X. Brown

Ranch Hand
+ Follow
since Nov 08, 2000
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Matthew X. Brown

We are running WAS 5.0 and Websphere Commerce 5.6. Commerce requires that version 1.1 EJB- which means we do not have the ability to do MDBs. Another requirement is that commerce db connections are not XA enabled. Without doing some serious hacking- How can I execute JMS code so that it is not considered transactional by the EJB container? I'm currently getting "An illegal attempt to use multiple resources that have only on-phase capabiity has occurred within a global transaction." When I attempt to run the JMS code from within a session bean. I am simply trying to put a message to the queue, NOT listen to the queue.

I already tried setting transaction attribut to "Not supported"- but to no avail.

Thank you

matt
15 years ago
I'm using the current SOAP implementation as provided by sun/java. I cannot seem to authenticate through our proxy. When I run my program from home, where I don't have a proxy server, the program successfully connects to a webservice... I've tried using the -Dhttp parameters to pass in- but to no avail. I'm using the System.properties to store the http proxy stuff- but it doesn't seem to work. Please let me know if you see anything in my code....
(Please note that I've perused the forums looking for an answer already to my question, and although I have found and tried many of the solutions, none have worked. So just to let you know, I've done some upfront work on this.....Here goes.......)
import javax.xml.soap.*;
import javax.activation.*;
import javax.naming.*;
import java.net.*;
import java.io.*;
import java.util.*;
import javax.xml.*;
import javax.xml.messaging.*;
import javax.xml.soap.*;
import javax.xml.parsers.*;
import org.w3c.dom.Document;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
import com.xxx.xxx.xxxx.databeans.*;
import com.sun.xml.messaging.jaxm.soaprp.*;
import java.net.*;
import java.io.*;
import com.xxx.xxx.xxxx.utilities.*;
import java.util.*;
public class WebServiceSendCmd {
private ProviderConnectionFactory pcf;
private ProviderConnection pc;
private MessageFactory mf = null;
private String from ="";
private String to = "";
private String data = "";
MessageFactory messageFactory;
public void Execute() {
}
public java.lang.String GetXml(java.lang.String argFileName) {
return null;
}
ArrayList SendMessage(AsnDto dto, EndPointConfiguration configEnd) { ArrayList list = new ArrayList();
try{
System.out.println("SENDING MESSAGE");
SOAPConnection con;
System.out.println(System.getProperty("java.class.path"));
Thread.currentThread().setContextClassLoader
(this.getClass().getClassLoader());
//get parser factory (uses contextclassloader)
this.messageFactory = MessageFactory.newInstance();

SOAPMessage soapMessage = messageFactory.createMessage();
String soapAction = "http://www.regom.de/Soup";
soapMessage.getMimeHeaders().addHeader("SoapAction",soapAction);
SOAPPart soapPart = soapMessage.getSOAPPart();
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
SOAPBody soapBody = soapEnvelope.getBody();
soapBody.addDocument(dto.getXmlDocument());
SOAPConnectionFactory soapFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapFactory.createConnection();
URLEndpoint pt = new URLEndpoint(configEnd.getUrl());
String host = "myproxy.host";
String userid = new sun.misc.BASE64Encoder().encode("UserName".getBytes());
String password = new sun.misc.BASE64Encoder().encode("password".getBytes());
java.util.Properties props = new Properties();
props.setProperty("http.proxySet","true");
props.setProperty("http.proxyHost",host);
props.setProperty("http.proxyPort","8080");
props.setProperty("http.proxyUser",userid);
props.setProperty("http.proxyPassword",password);
Properties systemProps = System.getProperties();
Enumeration iter = props.propertyNames();
while (iter.hasMoreElements()) {
String s = (String) iter.nextElement();
systemProps.put(s, props.getProperty(s));
System.out.println(s+" "+props.getProperty(s));
}
System.setProperties(systemProps);
Enumeration iter2 = System.getProperties().propertyNames();
while (iter2.hasMoreElements()) {
System.out.println((String) iter2.nextElement());
}
SOAPMessage replyMsg = soapConnection.call(soapMessage,pt);
Iterator i = replyMsg.getSOAPBody().getAllAttributes();
SOAPBody returnBody = replyMsg.getSOAPBody();
System.out.println(returnBody.toString());
while(i.hasNext()){
String xmlNode = i.next().toString();
System.out.println("NODES"+xmlNode);
}
MimeHeaders mimeHeaders = replyMsg.getMimeHeaders();
Iterator mimeList = mimeHeaders.getAllHeaders();
while(mimeList.hasNext())
System.out.println(mimeList.next().toString());
soapConnection.close();
list.add(returnBody);
}catch(Exception e){
e.printStackTrace();
}
return list;
}
16 years ago
We're currently having an internal debate at my company concerning how to handle requests and responses for services. One of the opinions is that we can send out a "standard" document, which transfers needed data in the standard document required for processing, and the process runs, then populating the some attributes following processing. All of the attributes are populated after the service runs through the document For example:
Request:
<service id="performTransfer" requestId="120003">
<stockTransfer flag="" valid="" invalid="" errorText="">AGC</stockTransfer>
<numberofshares flag="" valid="" invalid="" errorText="">100</numberofshares>
<ordertotal flag="" valid="" invalid="" errorText="">1000000<ordertotal>
<optionalProcessing>
<option name="debitAccount" success=""/>
<option name="sendEmail" success=""/>
</service>
Response:
<service id="performTransfer" requestId="120003">
<stockTransfer flag="Y" valid="Y" >AGC</stockTransfer>
<numberofshares flag="Y" invalid="N" errorText="Number of shares exceeds limit">100</numberofshares>
<ordertotal flag="Y" valid="Y">1000000<ordertotal>
<optionalProcessing>
<option name="debitAccount" success="N"/>
<option name="sendEmail" success="Y"/>
</service>

The other opinion is that we have separate request and response documents. The request provides data needed for processing it. The response sends back the status of the items and the results of processing.
<serviceRequest id="performTransfer" requestId="120003">
<stockTransfer>AGC</stockTransfer>
<numberofshares>100</numberofshares>
<ordertotal>1000000<ordertotal>
<optionalProcessing>
<option name="debitAccount"/>
<option name="sendEmail"/>
</serviceRequest>
<serviceResponse id="performTransfer" requestId="120003">
<stockTransfer flag="Y" valid="Y" >AGC</stockTransfer>
<numberofshares flag="Y" invalid="Y" errorText="Number of shares exceeds allowable number">100</numberofshares>
<ordertotal flag="Y" valid="Y" >1000000<ordertotal>
<optionalProcessing>
<option name="debitAccount" success="/>
<option name="sendEmail"/>
</serviceResponse>

Seems to me like the intent of the messages is clearer with option #2- but maybe i'm being too strict on this. I suppose that you could infer the intent of the message by looking to see if the valid/invalid flags are set. Let me know any thoughts.........
16 years ago
Are you behind a firewall? If so go to Window/Preferences/Internet in WSAD- put in your proxy server information. Then re-try it.
17 years ago
I'm using the command line startup parameter of -xrunhprof for use with HAT(Heap Analysis Tool from Sun). In order for the Heap Dump to get printed to the file, I need to be able to do the equivalent of a Control Break within Websphere. When I use XMLConfig shutdown- it doesn't seem to work- same thing with doing a "hard" shutdown of the websphere instance(via the control panel shutdown of the W2K service).
How would I issue the command for the system to come down that is equivalent to control break from within a simple java program?
Thanks in advance.
17 years ago
I would say that you do factories within the ObjectToTest class- but I was "projecting" that he doesn't want to change his ObjectToTest at all. If he doesn't mind changing his existing class- Factories are a good way of doing the mock objects(however the mock object implementation must call verify unto itself I'd think). I don't know how we'd get the handle to the actual mock object within the class to verify stuff.
Regarding the term "robust" I guess I simply meant that you can put alot more detail behind the way that the classes/objects are interacting- not that you can't describe that with CRC cards- its just more formalized within UML. You guys are correct- UML isn't a silver bullet- I just wanted to see how I could marry the two(XP/UML).
Factory won't solve his problem. Since his ObjectToTest directly instantiate the classes needed to be mocked(ie. they are strong typed)- factories won't make a difference. His issue is access.
The only way you could get access to test is possibly using AspectJ- via a crosspoint. Checkout Nicholas Lesiecki's article - http://www-106.ibm.com/developerworks/java/library/j-aspectj2/?open&l=007,t=gr
AspectJ does have a learning curve, so unless you already know it- I would spend my time refactoring the code. However Nicholas Lesiecki is confronting the problem you are having directly- he doesn't want to change existing code to accomodate testing.
Regarding refactoring- My 2cents on that is to consider making your API's accessible via Interfaces- passing in mock objects directly via Smart Handler is good- doing it with an Interface Structure in place will even be better, if not easier.
There seems to be alot of value in creating UML to ensure that the understanding of the system and requirements are clear. However, in XP- it seems that the only tools to model with are CRC cards, which are Ok- but aren't as robust as UML. Where does UML fit in with XP?
I have a tool called "RefactorIt"- and believe me-
don't use it. Maybe its evolved since I "won" fully licenced version about a year ago, but its not a very good tool. I use Eclipse for refactoring now.
I developed CMP Beans on WAS 3.5 using TDD- it was kinda silly- because so much of the code is generated for you(just like in Xdoclet)- by Visual Age/WSAD. Its a little different doing point and click type development with TDD- maybe with the exception of custom finders(which you need to hand code). However, the Junit tests that were derived as a result were valuable-I could change the CMP- then tweak the Junit class and run it- and know that my code was solid. I guess that is true wherever Junit is used....
Ok- Let me preface this by saying that we are not looking at options for doing persistent sessions in general- only selected data we want to persist.
That being said, we're looking at designing a way to persist selected cookies(I use the "cookie" term to differentiate from other "session" type objects) items into the database so that the person's web experience is more customized or personal. So basically we'd have their cookie data saved to the database. We can pretty easily do this via an EJB- probably via an entity bean associated with their userid, fronted with a Session Facade(stateless) Bean- that actually talks to the controller. Are there any patterns that might fit these requirements better than others? I envision a "cookie" field with delimiters basically tagging name value pairs within the field in the database. We setup a standard set and get utiliity methods to parse the name value pairs.
We want it to be general enough to use corporate wide for a variety of J2EE apps. So the name value pairs need to be customizable. I could serialize a HashMap to the database,(as a blob) but ths violates the "pragmatic programmer's" rule of persisting things in "plain text" where possible(for maintainability and migratability(is that a word?).
The nature of the data on the http sessions will be simple plain text items, such as-last order number.
I could code this thing pretty quick, but I just want to see what your opinions are.....
TIA
matt
Not being really on top of the JSR process-are there any JSRs currently that are geared towards Ant type tools?
17 years ago
I've been having problems integrating my ant builds with my sourceforge project. I want to pull from the CVS on the sourceforge server- has anyone been able to do this? I guess one of the problems is my firewall configuration, but are there ways of combining tasks to get a proxy authentication,so that I can pull in the source?

Thanks in Advance.
17 years ago
Sorry-I grabbed the wrong text....
<weblogic-ejb-jar>
<description><![CDATA[Generated by XDoclet]]></description>
<weblogic-enterprise-bean>
<ejb-name>Sequence</ejb-name>
<entity-descriptor>
<persistence>
<persistence-type>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-type>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
</persistence-use>
</persistence>
</entity-descriptor>
<reference-descriptor>
</reference-descriptor>
<local-jndi-name>middlegen.sequencegenerator.ejb.SequenceLocalHome</local-jndi-name>
</weblogic-enterprise-bean>
17 years ago