B Rook

Greenhorn
+ Follow
since Dec 27, 2003
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 B Rook

I have a question about EasyMock. I find that I am unable to mock calls to another method within the object (via this.). For example, I have 2 methods:

public A performTransformation(B b){
Log.addLogEntry();
return transform(b);
}
public A transform(B b)

I can test Log.addLogEntry and transform with JUnit. However, I want to test performTransformation. I don't really want to test transform or Log.addLogEntry again so I thought that I could use EasyMock. I can mock Log, but I can't add an expect for transform. Is there anyway to do this?

In the meantime, we've moved transform to another object and mocked that, however, this seems incorrect.

Any suggestions?
11 years ago
Hello,

we've been trying to use the commons-email package in order to create email transfer objects that we can send to our ejb classes, populate with a session and send. However, the SimpleEmail class doesn't implement serializable so we can't use it directly as an object in the method signature. I've created a new class called SerializedSimpleEmail which extends SimpleEmail and implements Serializable. However, when we get the object on the other end its empty. There is an object, but none of the fields are populated. We can debug and see that the object that we're sending is populated.

Does anyone have any experience doing what we're trying to do? Any suggestions on how to fix our problem?
I'm trying to use DBUnit. I've got a table that has some booleans fields defined as tinyint(1). However, when I extract this data from our test machine these fields are represented as 'false'/'true' and will not import back into a table that has those fields defined as tinyint(1). Is there a way to force DBUnit to export those fields as 0/1 or to allow MySQL to insert 'false'/'true' as 0/1?

Thanks
12 years ago
This is a good article about adding attachments if you want to use the javax.xml.soap.* package. However, AXIS wraps most of these classes for you. I was hoping to get a more AXIS specific message. I may have to try the AXIS mailing list.

Thank you,
13 years ago
I'm trying to send back both a string and a zip file from a webservice built using axis1_2RC1. here's the entry in the wsdl:


I can build and deploy and call the service but it fails with this message:


Here's the line that creates the datahandler:

DataHandler dh = new DataHandler(zipBytes,"multipart/*");

zipBytes is a byte[] and I wasn't sure what to use for the mime type so I used multipart/*, but that doesn't seem to work.

Are there any suggestions on how to send the attachment correctly?

Thank you
13 years ago
I have a related question. I have a DAO with several methods. I want to write a suite of tests to test the success and failure of each of these methods. My DAO is written so that it is passed a DataSource object in its constuctor and it can create a Connection object from that DataSource.

i.e.


How do I create a DataSource in JUnit so that I can test the DAO? Would I have to use Cactus? How would I create the DS in cactus?
13 years ago
I've recently developed a webservice that utilizes client-cert authentication and have it working on my workstation (Windows, java 1.4.1.03, jboss 3.2.6) and can talk to the webservice from another workstation.

However, when I move the webservice to the dev server (Linux, java 1.4.1.03, jboss 3.2.6) I get this error:

(401)Cannot authenticate with the provided credentials

I copied over my config files to linux directly from my windows configuration after setting up a new server keystore. What gives?
13 years ago
I've developed a webservice running in axis on jboss 3.2.6 / tomcat5.
Everything works fine. Our test server uses apache as the webserver.
When I put the application on the test server I get the following
error:

(400)No client certificate chain in this request

I know that the client certificate code works, because it worked when I
was using the tomcat webserver alone. It seem s like apache is doing
something that keeps the client certificate information from being
passed to tomcat.

We are passing requests from apache to tomcat via virtual host proxy
pass
<VirtualHost myserver:443>
ServerNamemyserver
SSLEngine on
SSLCertificateFile conf/ssl.crt/myserver.crt
SSLCertificateKeyFile conf/ssl.key/myserver.key
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
downgrade-1.0 force-response-1.0
ProxyRemote /* http://myserver:8080/
ProxyPass / http://myserver:8080/
ProxyPassReverse / http://myserver:8080/
</VirtualHost>

<VirtualHost dev.childsupport.state.co.us:80>
ServerName dev.childsupport.state.co.us
ProxyRemote /* http://myserver:8080/
ProxyPass / http://myserver:8080/
ProxyPassReverse / http://myserver:8080/
RewriteEngine on
RewriteRule ^/siteuser/(.*) https://myserver/siteuser/$1 [R,L]
</VirtualHost>

We are not using mod_jk (yet) and as far as I know we're not using
mod_ssl. What can I do to correct my problem with client_cert
authentication?

Thanks,
13 years ago
But you can run the adminclient program from the command line without specifying a url. That url is only needed to tell the adminclient program where the adminclient service lives. It doesn't tell the wsdl what to put in the service location attribute. I'm trying to find out why my service location attribute (in the wsdl) is saying something different that what is in my servicelocation class.

brian
13 years ago
I have a webservice that I've developed in java with AXIS. Everything works fine when I use tomcat as the webserver (port 8080). However, I'm trying to migrate it to the development server which uses Apache and proxy passes requests to tomcat. When I generate the wsdl (using the ant tasks) the service location looks like this:

<wsdlsoap:address location="https://mydevserver/axis/services/mySvc"/>

I then use this wsdl to generate the necessary classes and wsdd files (using the ant tasks). The address in the servicelocator says:
"https://myServer/axis/services/mySvc"

Which is correct.

When I register the webservice the wsdl that appears in the Admin page ("View the list of deployed Web services") has a service location that looks like this:

<wsdlsoap:address location="http://myserver:8080/axis/services/mySvc"/>

There is no "https" and it added the :8080. Why is it doing this? I am running the AdminClient registration tool via localhost:8080, is that the problem?
13 years ago
I'm trying to implement certificate based security in my application to secure by web services. I've found a little information, but was hoping that someone who has actually implemented it could help me out. Here's what I've got so far:

In order to lock down the request I added the following information to web.xml:

<!-- security constraint for web services -->

<security-constraint>
<web-resource-collection>
<web-resource-name>SecuredResources</web-resource-name>
<url-pattern>/services/MySvc</url-pattern>
</web-resource-collection>

<auth-constraint>
<role-name>W</role-name>
</auth-constraint>

<user-data-constraint>
<transport-guarantee>INTEGRAL</transport-guarantee>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>

<login-config>
<auth-method>CLIENT-CERT</auth-method>
<realm-name>UserDatabase</realm-name>
</login-config>

<security-role>
<role-name>W</role-name>
</security-role>

and the following entry to jboss-web.xml:

<jboss-web>
<security-domain>java:/jaas/cert-login</security-domain>
</jboss-web>


This means that the authentication for that security constraint will go to my cert-login entry in login-conf.xml (right?).

So, in login-conf.xml:

<!-- database based certificate authentication/authorization -->
<application-policy name = "cert-login">
<authentication>
<login-module code="org.jboss.security.auth.spi.BaseCertLoginModule"
flag = "required">
<module-option name="password-stacking">useFirstPass</module-option>
<module-option name="securityDomain">java:/jaas/ws-cert</module-option>
</login-module>
<login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule"
flag = "required">
<module-option name="password-stacking">useFirstPass</module-option>
<module-option name = "unauthenticatedIdentity">guest</module-option>
<module-option name = "dsJndiName">java:/MySqlDS</module-option>
<module-option name = "principalsQuery">select password from user where user_id=?</module-option>
<module-option name = "rolesQuery">select user_role, 'Roles' from user where user_id=?</module-option>
</login-module>
</authentication>
</application-policy>

this creates the cert-login entry. BaseCertLoginModule kept complaining about needing a security domain so I added the line with ws-cert and then added a corresponding securityDomain entry to jboss-service.xml:

<mbean code="org.jboss.security.plugins.JaasSecurityDomain"
name="jboss.web:service=SecurityDomain">
<constructor>
<arg type="java.lang.String" value="ws-cert"/>
</constructor>
<attribute name="KeyStoreURL">${jboss.server.config.url}/security/dev.client.keystore</attribute>
<attribute name="KeyStorePass">******</attribute>
</mbean>

I'm not sure which keystore I should be using here. The client keystore (same as the client should be sending with his request) or the server one?

Finally, would the database based authorization (setting roles) work as I have it setup? Is there a better login module (or combination) to use?

I would appreciate any assistance.
13 years ago
I'm getting a tiles error when upgrading from 3.0.8 to 3.2.5. On 3.0.8, this would only cause a warning, but on 3.2.5 this causes a full error that stops the application. It looks like the problem is with the tiles:include tag. Whenever this tag is used, we get an error like this:

(On the actual page in the browser)
[ServletException in:/WEB-INF/jsp/LoggedUserLayout.jsp] org.apache.struts.taglib.EnumerateTei'


(From the stack trace)
15:09:11,218 ERROR [Engine] ApplicationDispatcher[/siteuser] Servlet.service() for servlet jsp threw exception
java.lang.ClassNotFoundException: org.apache.struts.taglib.EnumerateTei
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
(further down...)
at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881)
at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
at org.apache.jsp.WEB_002dINF.jsp.overview.CSEWorkerIndex_jsp._jspx_meth_tiles_insert_0(CSEWorkerIndex_jsp.java:
86)
at org.apache.jsp.WEB_002dINF.jsp.overview.CSEWorkerIndex_jsp._jspService(CSEWorkerIndex_jsp.java:59)


Struts.jar (version 1.1) is in the WEB-INF/lib directory and not in the container lib directory. Here is the code from the .jsp:

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
...
<td valign="top">
<!-- CONTENT HERE -->
<tiles:insert attribute="body"/>
<!-- End Main Content Here -->
</td>


Does anyone have a suggestion as to what is the cause?

Thanks,

Brian
13 years ago
I disagree. I've been working on this project with the original poster. It is not necessary to point to a .wml file to point to a .jad file. We have successfully installed on several devices by making a request to the .jad file alone.
14 years ago