First, an explanation of why it behaves the way it does. this is not
an excuse, but it's an excuse, if you catch my meaning.
My not-an-excuse: when I think of unit testing, I think of developing
locally. period. I don't know why it's that way, but in my head,
developing locally is the only sensible way to develop. I think this
way because for 3 years I developed on a shared dev server and it
sucked, big time. When "New Consultant Guy" comes into work and writes
"while (true) true;" and the dev server keeps crashing every 3 minutes
for 2 hours straight... that tends to sour a man.
So, when I wrote the plugin, I wrote it only thinking of local
development. I didn't give any thought at all to the actual networking
side of things. It's disturbing, to look at the plugin code, and see
how many lines are devoted to the webservice call to the remote
facade. I remember when bill told me he was having authentication
issues over ntlm, my first reaction was "why the f**k are you trying
to connect to a non-localhost server?". my second reaction was "and
what the f**k is ntml?".
Shows you what I know.
OK, end of excuse. On to solutions.
I originally wrote the webservice calls in good old axis 1.x
Service.call() style because that's how I like it. no lame wsdl2java
codegen for me. and at the time of writing the plugin (summer/fall of
07), it had been a solid 3 years since i'd worked with java web
services. so my comfort was with axis 1.x. I checked out the axis 2
docs, it looked like a completely different product and I didn't want
to learn it, so I stuck with 1.x.
Sadly, I think the time has come to make the switch. It looks like you
can use Commons HTTP with 1.x, but unless i'm mistaken it looks like a
giant pain in the ass. And it looks like NTLM is supported natively
with axis 2 b/c it seems, if my reading is correct, that axis2 uses
commons http by default.
Now, the hard part really is figuring out how to intelligently handle
authentication within the plugin itself. because there are several
different types of authentication, and I know exactly 0 about any of
them, so I dont' really know the best way to proceed. Is it enough to
put some fields in the plugin for username/password? I wonder how
inside the plugin i'm supposed to know what authentication scheme to
use. And... I wonder if there's a better way than doing all of that.
This is what I have to find out. Ideally, the plugin would just plain
not have to worry about all of it; like, maybe it has access to some
kind of authenticated session in windows or something. I don't know...
but that would be nice.
The other problem here is that since I don't know jack about NTLM, I
don't know how to test it locally once I think I have a fix.
Bill, you have the "Services Explorer" plugin, right? I think that
comes with the web tools project. If you would be so kind, would you
see if you can access an NTLM-secured WSDL file using that plugin?
Because if you can, that must mean they're doing something dynamic
under the hood that handles all this without needing to prompt you for
credentials, and if that's the case, then maybe I can talk with those
folks and find out how they're doing it.
So, while I wish everyone would know the joy of developing locally, I
understand that isn't always possible. I want to get these
authentication problems worked out... it'll teach me a lot and it's a
fun challenge. But it's going to take a while.
Lame excuse #2 coming, Goyiux: I just had another daughter 2 weeks
ago, Bill's sellling his house, and we're preparing for a few
presentations right now and those preparations are taking up all of
(my) free time. I'm going to try to learn more about this ntml stuff
and see what i can whip up with axis2, but I fear it'll be some time
before I can spend the time required to get this into the plugin.
Now... were you to respond with "But Marc, I Goyiux am a Axis2 and
NTLM expert and here's all you need to know" well, then, that'd be
swell!
As I learn more about these things, I'll post back with my findings
and more questions.
Thanks.
Marc
maybe i'll try first to see if i can with some ease switch axis 1.4 to
use commons http. if i can do that, i'll try to knock this bastard out
soon. if not, i'll try to figure all this out with axis2 because i
think it uses commons.
thanks G. you're a gentleman and a scholar and i'm proud to work with you.
Now where's my cohibas?
anyway, i got axis using httpclient and i'm able to send
usernames/passwords and supposedly under the hood axis will handle the
details of the authentication method.
Goyiux, are you familiar with subversion? If so, i could put a test
together and you could create a new project in eclipse that links to
the plugin source code. i'd have a junit test where you could add your
URL, username, and password, and then we could test to see if all this
code works wtihout me having to worry about the plugin details for
now.
If the code changes I made do work, the I can get them into the plugin
fairly quickly.
You want to try that?
Marc
i got it all working with basic auth, but with nt auth, it looks to me
like axis 1.4 doesn't understand that it needs to use NTCredentials
instead of UsernamePasswordCredentials on the underlying httpclient
auth scheme (see Goyiux... this morning I didn't know shit about shit,
and now i'm johnny auth. The best bugs are the kind that teach you a
lot).
So even though I read stuff where it says you should be able to use
axis 1.4 with ntlm, other stuff i found on the newsgroups from the guy
who wrote axis basically indicates that this "confusion" isn't fixed
in axis 1 but is fixed in axis2.
This sucks because it delays things a bit. It means I definitely have
to switch to axis2 now.
Oh well... can't use other people's 4 year old code forever i guess.
damn whippersnappers.
Updates to follow as I drink more beer.
goyiux, i've added some jar files and new code to the plugin, so
you'll need to do a team update.
then, to configure your build path, you'll need to right click on your
project, go to "build path", "configure build path".
that'll pop up a property sheet and there will be a "libraries" tab. go to that.
click "add jars"
navigate to the org.mxunit.eclipseplugin lib directory. there will be
a bunch of jar files in there. select them all and click OK on all the
property sheets
Then, back in the package explorer, open up
test/org.mxunit.eclipseplugin.actions.bindings
RemoteFacadeServiceTestCase.java
At the top, change the url, username, and password to what yo'ure trying to use.
then, right click in the window, select "run as", "Junit Test Case"
then tell me what you get.
I also put in an HttpClientTest in that directory that you could try
out, too, if that test case above doesn't work. for me, though, it
didn't matter what username or password I used.... i always got
through to the wsdl file even though it was supposed to be ntlm
protected.
Bill, you wanna give these steps a shot, too, with your stuff and see
if you are able to access the remote facade CFC by using your ntlm
credentials?
Also, moving to axis2 isn't possible now. the reason is that axis2
does not support rpc-encoded style services, and that's what this is.
We've been trying really hard to keep mxunit compatible with mx6.1,
and they didn't introduce doc-literal style webservice support until
mx7.
but i'm not sure that it matters anyway. now that i have a fuller
picture, i don't think axis2 will solve any problems that axis1 can't
handle.
Thanks guys.
Marc
select the project containing your tests, right click, select
properties, select mxunit. you'll see the username and password fields
at the bottom. plug in your credentials, click OK, and try running
tests.
It works for me with basic. I can't get ntlm auth working on my
machine but I Think that's a function of my machine and not the code,
since technically I'm not on any domain. So hopefully you guys have
better luck than I did.
Good luck!
Marc
best,
marc
Before I investigate this any further, Bill, can you see what you get
when you try out the code on your ntlm-protected stuff?
and i'm going to see if one of the network dudes at work can get me
set up properly so that I can confirm I have a correctly configured
ntlm environment, which will help me test this thing and see if
there's any other stones unturned.
Marc
On Feb 18, 2008 1:32 PM, Goyuix <goy...@gmail.com> wrote:
>
in axis, that's how you do it. then, under the hood, it parses out the
domain name and passes that to the NTCredentials object in httpclient.
Also, the error message without the ampersand is just a weirdo bug i
haven't figured out yet. for me, the error message has the ampersand,
for some folks it doesn't show up. it's irrelevant, though, because
the actual code has nothing to do with executing the URL that way...
it's an entirely different mechanism.
Also, just make sure you're sending the right username/password in the
project properties, and make sure that if you're using ntlm, you're
sending the username in the form of domain\username.
Marc
as a compromise, would it be possible for you to do this:
1) on your server, set up a new virtual site or directory. have that
site use basic authentication
2) create a new file in that site called RemoteFacade.cfc
3) make the contents of that file:
<cfcomponent extends="mxunit.framework.RemoteFacade">
</cfcomponent>
best,
marc