Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

problem creating REMOTE PAGES in confluence usin JIRA both on my local server.

Nagmani Nagmani January 24, 2012

import org.swift.common.soap.confluence.ConfluenceSoapServiceServiceLocator

def locator = new ConfluenceSoapServiceServiceLocator()
def service = locator.getConfluenceserviceV2(new URL("http://localhost:8090"))
def token = service.login("admin", "password")

def page = new RemotePage (
content: issue.description,
creator: "admin",
title: issue.summary,
space: "DS",
homePage: false,
created: Calendar.getInstance(),
modifier: "admin",
version: 1,
modified: Calendar.getInstance(),
)

service.storePage(token, page)

I am using the above code where I need to create automatic page in confluence for a project for any issue created under that project in JIRA.

I have downloaded groovyrunner plugin. and I could use the script runner plugin in my JIRA successfully . But whenever I am trying to run the above code I am getting result as "

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script3.groovy: 7: unable to resolve class RemotePage @ line 7, column 12. def page = new RemotePage ( ^ 1 error "....
The URL above corresponds the one of the confluence on my local server...
Can anyone suggest any think on that...

6 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Nagmani Nagmani January 25, 2012

I guess I need to do some changes in my installation of groovy..because this url is not working in my script and showing error..

Thanks..

Nagmani Nagmani January 25, 2012

Hi jamie,

I am getting the wsdl page while using this link http://localhost:8085/rpc/soap/jirasoapservice-v2?wsdl for jira but for confluence http://localhost:8090/rpc/soap-axis/confluenceservice-v1 is not showing the desired page..

anything more could you suggest for any improvement.

Thanks

Nagmani Nagmani January 26, 2012

Well..After doing some changes now I can see the wsdl page using url.(http://localhost:8090/rpc/soap- axis/confluenceservice-v1...Thanks for the help..but still the problem is there I am gettin error as

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 6: unable to resolve class RemotePage @ line 6, column 12. def page = new RemotePage ( ^ 1 error
for following piece of code..
import org.swift.common.soap.confluence.ConfluenceSoapServiceServiceLocator
def locator = new ConfluenceSoapServiceServiceLocator()
def service = locator.getConfluenceserviceV2(new URL("http://localhost:8090/rpc/soap- axis/confluenceservice-v1"))
def token = service.login("nagmani.sinha", "password")
def page = new RemotePage (
content: “groovy_working”,
creator: "nagmani.sinha",
title: “groovy”,
space: "groovy",
homePage: false,
created: Calendar.getInstance(),
modifier: "nagmani.sinha",
version: 1,
modified: Calendar.getInstance(),
)
service.storePage(token, page)
Is there any problem in pasing content as a constant string filed as I have passed it as"groovy_working.."...please suggest..
Thanks.
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 26, 2012

Can you tell me the exact name of the file you copied to web-inf/lib from the confluence CLI plugin, please?

Nagmani Nagmani January 26, 2012

its confluence-soap 4.0.0.jar file... and groovy 1.7.14.jar

Do I need to copy any more files..?

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 26, 2012

Ah, you're just missing your import. Put this at the top:

import org.swift.common.soap.confluence.RemotePage

3 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2012

Did you copy the confluence-soap-model jar? If so what was the exact file name? Also where did you copy it to.

Nagmani Nagmani January 24, 2012

I kept it in following folder C:\Program Files\Atlassian3\JIRA\atlassian-jira\WEB-INF\lib

Nagmani Nagmani January 24, 2012

import org.swift.common.soap.confluence.ConfluenceSoapServiceServiceLocator

def locator = new ConfluenceSoapServiceServiceLocator()

def service = locator.getConfluenceserviceV2(new URL("http://localhost:8090/confluence/rpc/soap-axis/confluenceservice-v1"))

def token = service.login("admin", "password")

def page = new RemotePage (

content: “groovy_working”,

creator: "admin",

title: “groovy”,

space: "groovy",

homePage: false,

created: Calendar.getInstance(),

modifier: "admin",

version: 1,

modified: Calendar.getInstance(),

)

service.storePage(token, page)

I have made these changes as i didn't created any issue so issue.description wouldnot be valid in my context of code...help me if I did anything wrong.

Nagmani Nagmani January 24, 2012

Please let me know what changes should I make in the url field to get the fqdn format...as I think what I am passing as url is my fqdn...("http://localhost:8090")).. what should be added to get fqdn if its not the fqdn

Thanks in advance.

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2012

I've asked you before and I'm going to ask you again. Do you see a page when you go to: http://localhost:8090/confluence/rpc/soap-axis/confluenceservice-v1 ?

Nagmani Nagmani January 24, 2012

I get a page but with the tag "PAGE NOT FOUND"...I can redirect to my own dashboard with the link in that page but I dont get my confluence home page while clicking on this link....

Nagmani Nagmani January 24, 2012

Yes I get a page but with the tag "PAGE NOT FOUND"...that page is having the link through which I can direct my self to my dashboard of confluence...But I dont get my confluence home page at once while clicking on the above link....

Confluence Page Not Found

The page you were trying to reach could not be found. This could be because:

  • The page does not exist.
  • The page exists, but you do not have permission to view it.

Site Search

<form action="/dosearchsite.action" method="get" name="searchForm"><input id="searchfield" accesskey="s" type="text" name="queryString" size="40"/><input type="submit" value="Search"/></form>
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2012

Right, so your task is to work out where the wsdl is. How about:

http://localhost:8090/rpc/soap-axis/confluenceservice-v1?wsdl ?

Nagmani Nagmani January 24, 2012

I am getting followin page which I think is again of no use as such..

confluenceservice-v1

Hi there, this is an AXIS service!

Perhaps there will be a form for invoking the service here...

Dont know exactly how to figure this out..will have to work on this..

Thanks a lot for your constant support..


JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2012

Can you paste here the exact url you used to get the above, and the url you are using in your script.

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2012

Anyway that looks like the correct url, so make sure that is the url you are using in your script.

Nagmani Nagmani January 24, 2012

the one u send me..

http://localhost:8090/rpc/soap-axis/confluenceservice-v1?wsdl ? as my port no is same as yours 8090.

and the one I am passing in my script is ("http://localhost:8090/

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2012

What you need in your script is: http://localhost:8090/rpc/soap-axis/confluenceservice-v1

0 votes
Nagmani Nagmani January 27, 2012

Yep exactly..Now the problem is resolved for remote pages... You are really giving me a gr8 help... Wanted to know one more thing what shoould be the value in "content" as it is showing error in case if I pass some constant string value as in above case where I have passed "groovy-working"...Any more suggestions for this case...

Thanks..

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2012

You need to tell us what the error is, and yes I am giving you some gr8 help, so can you vote up my answers and comments.

Nagmani Nagmani January 27, 2012

javax.script.ScriptException: groovy.lang.MissingPropertyException: No Such property: "groovy_working" for class: Script3

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2012

Thanks for the points, much appreciated.

In your code, you put "groovy_working", with the quotes, but the error implies that you didn't have any quotes, so it's treating it as a variable you haven't defined.

There are lots of good short groovy, and java, tutorials out there. You can get far with just seeing what works, but in the end learning a bit of the language is a good investment of your time.

Nagmani Nagmani January 28, 2012

Thanks Jamie for your constant support...And finally I could say I got the desired output..It really works..!!!

Very useful plugin for sure..

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2012

Great, well done. And thanks.

Final step is to mark one of my answers as correct, by clicking the tick mark/check mark.

Nagmani Nagmani January 29, 2012

jamie,

The code is working fine with the constant string value that I am using in my above script.

1. I want this to trigger using post function whenevr a new issue is created under any project.

BUt I am unable to retrieve the "issue key" to use it in my script.

2. and the script path that I am giving to the post function is also not working as I gave it as "C:\Documents and Settings\nagamani.sinha\My Documents\job.doc" I am not sure what changes to make...

See if you can help me for this.

Thanks,

Nagmani

Nagmani Nagmani January 29, 2012

I am using this scriptof yours to get the issue key so as to use it in thecontent part of script instead of the fixed value that I have set right now..:

import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import org.apache.log4j.Category
log = Category.getInstance("com.onresolve.jira.groovy.PostFunction")
log.debug "Issue key is ${issue.key}"

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2012

You really should be asking a new question...

The filename should end in .groovy.

What output do you get for your line? If nothing try log.warn(...).

Nagmani Nagmani January 31, 2012

I pasted the whole script in a doc file and kept that in mydocuments folder.

So I gave the script file path as "C:\Documents and Settings\nagamani.sinha\My Documents\job.doc"

Do I need to just change the extension as ".groovy" or something else need to be done.

Nagmani Nagmani January 31, 2012

Please answer this question on below link as I have asked this question separately on below linkl.

https://answers.atlassian.com/questions/32597/how-to-get-script-file-path-for-implementing-script-post-fucntion-usin-script-runner-plugin-in-jira

Nagmani Nagmani January 31, 2012

how to get the project name in "title" field and its summary in content field...currently I am passing a constant tring value in these columns but this wont serve my purpose unfortunately.

Please suggest me how to get project name under title field whenever I write postfunction for a create issue under that project...

Thanks

Nagmani

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2012

You need to ask a new question. Asking different questions in the same thread doesn't help people find similar problems.

Nagmani Nagmani January 31, 2012

kindly check this thread for my new question and please help me if you could.

thanks

https://answers.atlassian.com/questions/32641/how-to-get-project-name-through-groovy-script-to-use-under-script-runner-plugin

0 votes
Nagmani Nagmani January 24, 2012

I get a page but with the tag "PAGE NOT FOUND"...I can redirect to my own dashboard with the link in that page but I dont get my confluence home page at once while clicking the above url link

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 24, 2012

Don't use this version of the script, I just wrote that off the top of my head. The other one I actually tested.

0 votes
Nagmani Nagmani January 24, 2012

package examples

import org.swift.common.soap.confluence.ConfluenceSoapServiceServiceLocator


def locator = new ConfluenceSoapServiceServiceLocator()
def service = locator.getConfluenceserviceV2(new URL("http://localhost:8090/"))
def token = service.login("admin", "password")
def page = service.getPage(token,"MYSPACE","groovy")
page.content = "groovy_created"
service.updatePage(token, page)

for this code I am getting the error as a result:

javax.script.ScriptException: org.xml.sax.SAXException: Processing instructions are not allowed within SOAP messages
Caused by: org.xml.sax.SAXException: Processing instructions are not allowed within SOAP messages
at org.apache.axis.encoding.DeserializationContext.startDTD(DeserializationContext.java:1161)
at org.apache.xerces.parsers.AbstractSAXParser.doctypeDecl(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.doctypeDecl(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.scanDoctypeDecl(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events