forums | 21 Oct 10:46 2010

Need help in writing SOAP API

Hi,

I was writing an application which will use the JIRA SOAP APIs but found out that not all the features are
available using the existing SOAP. So I decided to add some new APIs. But I am facing some problem to load the
new WSDl.

Here's what I have done so far:
1. Downloaded the atlassian-jira plugin from
https://studio.plugins.atlassian.com/source/browse/JRPC (tag atlassian_jira_4_1_2).
2. Setup Ecliplse to use Maven.
3. Added a new class (in the beans package) and a new API in the JiraSoapService.
4. Build as maven package.
The Build was successful and a new jar (atlassian-jira-rpc-plugin-4.1.2-1.jar) was created.
I copied this jar into the atlassian-jira/WEB-INF/lib/ directory of JIRA installation and restarted JIRA.
In the wsdl, I can find out the new API exposed but when I try to use the wsdl in a application (say SOAP-UI), it
fails to load and gives a Java.lang.NullPointerException.
I am stuck into this and can not find out any solution.
Am I missing some steps.

Regards,
Rajib
--
Post by RajibKarmakar - online at:
http://forums.atlassian.com/thread.jspa?forumID=100&threadID=48409
forums | 21 Oct 11:00 2010

Re: Need help in writing SOAP API

If you're seeing the new API exposed, then no, you're not missing any steps.  It must be down to a flaw in your
code in the plugin.  I'm afraid you need to start ploughing through the logs in detail to find out what is
wrong.  The lines around the NPE should at least tell you where the error is and hint at what is causing it.
--
Post by broughn2 - online at:
http://forums.atlassian.com/thread.jspa?forumID=100&threadID=48409
forums | 21 Oct 11:13 2010

Re: Need help in writing SOAP API

Hi Nic,
Thanks for ur reply. I went through the log and found out that there are some fields named as Objects which are
causng the problem. The following are the SOAP-UI log

14:24:48,435 DEBUG [WsdlLoader] Getting wsdl component from [http://192.168.10.121:8080/rpc/soap/jirasoapservice-v2?wsdl]
14:24:48,779 DEBUG [AbstractDefinitionContext] Loading Definition...
14:24:48,779 DEBUG [WsdlInterfaceDefinition] Loading WSDL: http://192.168.10.121:8080/rpc/soap/jirasoapservice-v2?wsdl
14:24:48,779 DEBUG [AbstractWsdlDefinitionLoader] Returning baseInputSource [http://192.168.10.121:8080/rpc/soap/jirasoapservice-v2?wsdl]
Retrieving document at 'http://192.168.10.121:8080/rpc/soap/jirasoapservice-v2?wsdl'.
14:24:49,050 INFO  [SchemaUtils] Loading schema types from [http://192.168.10.121:8080/rpc/soap/jirasoapservice-v2?wsdl]
14:24:49,050 INFO  [SchemaUtils] Getting schema http://192.168.10.121:8080/rpc/soap/jirasoapservice-v2?wsdl
*14:24:49,136 ERROR [SoapUI] An error occured [Invalid QName value: Localname not a valid NCName in
'tns3:Object[]'], see error log for details*
*14:24:49,141 WARN  [SchemaUtils] Error:
http://192.168.10.121:8080/rpc/soap/jirasoapservice-v2?wsdl:0: error: invalid-value: The
value 'Object[]' is an invalid name.*
14:24:49,141 ERROR [SoapUI] An error occured
[com.eviware.soapui.impl.wsdl.support.xsd.SchemaException], see error log for details
14:24:49,151 ERROR [AbstractDefinitionContext] Loading of definition failed for
[http://192.168.10.121:8080/rpc/soap/jirasoapservice-v2?wsdl];
com.eviware.soapui.impl.wsdl.support.xsd.SchemaException: Error loading schema types
14:24:49,151 ERROR [SoapUI] An error occured [Error loading schema types], see error log for details
14:24:49,153 ERROR [AbstractDefinitionContext] Error loading schema types from
http://192.168.10.121:8080/rpc/soap/jirasoapservice-v2?wsdl, see log for details
14:24:50,900 ERROR [SoapUI] An error occured [java.lang.NullPointerException], see error log for details

I am also attaching my wsdl. can you please let me know why are some fields shown as Objects[]?
--
Post by RajibKarmakar - online at:
http://forums.atlassian.com/thread.jspa?forumID=100&threadID=48409
(Continue reading)

forums | 21 Oct 12:03 2010

Re: Need help in writing SOAP API

I'm approaching the edge of my knowledge here, but fields shown as Objects tend to mean the code in the SOAP
plugin can't translate them completely into fields for some reason.

You'll need to read the Jira application log to find out what's going on there - consider upping the logging
in "logging and profiling" too.
--
Post by broughn2 - online at:
http://forums.atlassian.com/thread.jspa?forumID=100&threadID=48409
forums | 21 Oct 13:18 2010

Re: Need help in writing SOAP API

Well what I have done is just add a new class in beans package and use that class in the new APIs. Do you think
that I need to mention rhese changes somewhere or modify some more files in order to get this done?
--
Post by RajibKarmakar - online at:
http://forums.atlassian.com/thread.jspa?forumID=100&threadID=48409
forums | 21 Oct 13:49 2010

Re: Need help in writing SOAP API

Possibly.  There's no way of knowing without seeing what Jira thinks the problem is, or the raw code.
--
Post by broughn2 - online at:
http://forums.atlassian.com/thread.jspa?forumID=100&threadID=48409
Sohail Somani | 21 Oct 14:37 2010

Re: Need help in writing SOAP API

On 10-10-21 5:13 AM, forums@... wrote:
> *14:24:49,136 ERROR [SoapUI] An error occured [Invalid QName value: Localname not a valid NCName in
'tns3:Object[]'], see error log for details*

It looks like you're trying to return or accept a Object[] which I think 
is not allowed otherwise how would you serialize/deserialize in a 
platform agnostic manner?

Try replacing Object and use a class like:

class Something
{}

And see if the errors go away.

Good luck!

--

-- 
Sohail Somani
Hassle-free time tracking for JIRA

Website: http://worklogassistant.com
Blog   : http://blog.worklogassistant.com
Twitter: http://twitter.com/wlogassistant

forums | 21 Oct 14:46 2010

Re: Need help in writing SOAP API

Hi Sohail,
I indeed dont want any data of type object[]. But after I build my package some data are of that format. I am not
sure why this is happening. I have added a new class RemoteCustomField and that type is reflected
correctly in the wsdl. Please help.
Regards,
Rajib
--
Post by RajibKarmakar - online at:
http://forums.atlassian.com/thread.jspa?forumID=100&threadID=48409
Sohail Somani | 21 Oct 16:15 2010

Re: Need help in writing SOAP API

On 10-10-21 8:46 AM, forums@... wrote:
> Hi Sohail,
> I indeed dont want any data of type object[]. But after I build my package some data are of that format. I am
not sure why this is happening. I have added a new class RemoteCustomField and that type is reflected
correctly in the wsdl. Please help.
> Regards,
> Rajib

Not sure but I believe the types need to be POJOs.

--

-- 
Sohail Somani
Hassle-free time tracking for JIRA

Website: http://worklogassistant.com
Blog   : http://blog.worklogassistant.com
Twitter: http://twitter.com/wlogassistant

forums | 21 Oct 16:17 2010

Re: Need help in writing SOAP API

Check if your bean is extending AbstractNamedRemoteEntity. If not try extending that and see if it makes
any difference.
--
Post by jobinkk - online at:
http://forums.atlassian.com/thread.jspa?forumID=100&threadID=48409
forums | 21 Oct 16:21 2010

Re: Need help in writing SOAP API

I think I got this resolved. What I was doing is returning data of a type which was not exposed through wsdl. I
wrote a wraper class that exposes that datatype and it got resolved. Thanks a lot for your replies.
--
Post by RajibKarmakar - online at:
http://forums.atlassian.com/thread.jspa?forumID=100&threadID=48409
Sohail Somani | 21 Oct 20:08 2010

Re: Need help in writing SOAP API

On 10-10-21 10:21 AM, forums@... wrote:
> I think I got this resolved. What I was doing is returning data of a type which was not exposed through wsdl. I
wrote a wraper class that exposes that datatype and it got resolved. Thanks a lot for your replies.

Good on you for reporting the solution :)

--

-- 
Sohail Somani
Hassle-free time tracking for JIRA

Website: http://worklogassistant.com
Blog   : http://blog.worklogassistant.com
Twitter: http://twitter.com/wlogassistant


Gmane