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

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

1 vote
Answer accepted

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..

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

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.

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

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

Do I need to copy any more files..?

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

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

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

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

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.

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.

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 ?

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....

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>

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

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

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..


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

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

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/

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

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)

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

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

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..

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.

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

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.

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

Very useful plugin for sure..

Great, well done. And thanks.

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

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

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}"

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(...).

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.

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

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Friday in United States

Confluence Security Advisory

Good morning Members, Not sure if you are aware. Please read the following: https://www.icloud.com/keynote/0RyJ4VEdNUpjDpGfMhfZx9fEg#Confluence_Security_Advisor More details: https://co...

75 views 1 0
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you