Web Service example

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
peterw2000
Posts: 28
Joined: Mon Apr 06, 2009 9:27 pm
Contact:

Web Service example

Post by peterw2000 »

HIi

I read in a post where you sent a sample bvm to a guy who was struggling with setting up Aware IM as a web service.

I can't find the post again, but would really like a sample as well.

I'm trying to set up a web service so that Aware IM receives a "test result" from an external application, and then stores it in internal business objects.

I read how I am supposed to set up a service and then connect it to a process, but I'm having the same problem the other guy was having with working out how to do the process bit

Any help would be appreciated

Thanks
Peter
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

We have sent an example BSV to you.
Aware IM Support Team
peterw2000
Posts: 28
Joined: Mon Apr 06, 2009 9:27 pm
Contact:

Post by peterw2000 »

Thanks.

Unfortunately it would seem the example you sent me if for consuming a web service, not providing a web service.

In particular I'm looking for an example to set the attributes on the custom reply for a web service.

I have created a service called "MyService02", it has no inputs but returns a custom reply called "MyReply02".

The reply has two attributes p1 which is a string and p2 which is a number

I set default values of the attributes.

I published and logged in as instructed, the WSDL looks fine, I then called the service using a ruby script, this works ok, I'm not getting any errors in the Aware IM Server log, but I am getting a com.bas.connectionserver.server.AccessDenied error in the Tomcat log.

I checked the access levels for the admin for the service and processes, and they're full access.

I'm working on a different computer, so I'll just post this then post more details from the other computer
Peter
peterw2000
Posts: 28
Joined: Mon Apr 06, 2009 9:27 pm
Contact:

Post by peterw2000 »

Here is my ruby code for consuming the service

Code: Select all

require 'soap/wsdlDriver'

wsdl = "http://localhost:8080/AwareIM/services/ActiveMonitor?WSDL"
driver = SOAP::WSDLDriverFactory.new("http://localhost:8080/AwareIM/services/ActiveMonitor?WSDL").create_rpc_driver
response = driver.MyService02 "ActiveMonitor", "admin", "password"
print response, "\n"
print response.p1, "\n"
print response.p2, "\n"
This is the output

Code: Select all

#<SOAP::Mapping::Object:0x35468e0>
nil
nil
the stack trace from the tomcat log is:
Received request for service

Exception thrown in web service MyService02

Code: Select all

com.bas.connectionserver.server.AccessDeniedException null

com.bas.connectionserver.server.AccessDeniedException

	at com.bas.connectionserver.server.ConnectionFactory.createLocalSocketConnection(Unknown Source)

	at com.bas.webapp.webservices.ActiveMonitor.MyService02(ActiveMonitor.java:91)

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.lang.reflect.Method.invoke(Unknown Source)
I trimmed some of the trace off.

the fact that I get nil when I try to print p1 and p2 indicates the WSDL is good and the call is getting through. When I had the business space wrong before I was getting excpetions when I tried to print and errors in the Aware IM server log, saying it was an unknown business space, so I think this is pretty close.

Any help would be appreciated
Thanks
Peter
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

This seems to indicate that Aware IM does not recognize credentials of the request and refuses access. Are you sure you pass correct business space name, user name and password?

We will send you an example of providing a service.
Aware IM Support Team
pbrad
Posts: 781
Joined: Mon Jul 17, 2006 11:03 pm
Location: Ontario, Canada

Post by pbrad »

Hi,

It is time for me to finally get off my butt once and for all and get a good handle on services. Would you mind emailing me both the receiving example and the providing example? Maybe these should be part of the install package?

Much appreciated,
Pete
peterw2000
Posts: 28
Joined: Mon Apr 06, 2009 9:27 pm
Contact:

Post by peterw2000 »

Are you sure you pass correct business space name, user name and password
I think so.

If I change the business space name to something invalid I get a message in the Aware IM Server log.

If I change the service name in the consumer to something incorrect, I get an error in the consumer.

However, changing the password and user name in the consumer has no effect.

So it seems that the call is getting through correctly, just the username and password are not working. This could be something wrong with my consumer.

Is there any way to get the Tomcat layer to put out more trace so I can see what is going on?

Thanks
Peter
peterw2000
Posts: 28
Joined: Mon Apr 06, 2009 9:27 pm
Contact:

Post by peterw2000 »

We will send you an example of providing a service.
Thanks. I tried out the service "ServiceNoParams" with my ruby consumer:

Code: Select all

driver = SOAP::WSDLDriverFactory.new("http://localhost:8080/AwareIM/services/AwareTrial?WSDL").create_rpc_driver
response = driver.ServiceNoParams "AwareTrial","admin", "password"
And I'm getting the same error in the Tomcat log. I completely reinstalled aware IM, removed awareim dir from c drive, removed bas schemas from mysql, reinstalled, created a business space called AwareTrial and loaded your bsv into it.

BTW, the WSDL didn't show up until after I restarted the servers.

Does this work for you?
Peter
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

I am not familiar with Ruby, so I don't know the actual SOAP message that goes through the wire after your code is translated.

Can you print out the actual SOAP message and compare it with the WSDL that Aware IM requires?
Aware IM Support Team
peterw2000
Posts: 28
Joined: Mon Apr 06, 2009 9:27 pm
Contact:

Post by peterw2000 »

I'm not that familiar with ruby either, but I'll try to print out the soap messages. That's a good idea and should help us to see what is going on.

What I meant by "Does this work for you" was: are you able to consume your own web service that you sent me without the error in the tomcat log? It doesn't have to be with ruby.
Peter
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Last time we tested everything was working perfectly. So unless some bug crept in in one of the latest builds... (unlikely)
Aware IM Support Team
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

The problem was actually in the password value - it has to be encrypted. The encrypted value for "password" is 5f4db43b5ad965aa1dfd27a2c8feb1e7, so you need to replace "password" with the above value.

(you can use the PWD_ENCRYPT function to get encrypted values for different passwords or look at the database table)
Aware IM Support Team
Post Reply