Need to remove some properties from Junit xml report generated through SOAPUI (open source) - jenkins-plugins

While running my API test via jenkins(linux machine), its generating Junit report xml with some invalid character in properties tags.
<property name="LESS_TERMCAP_us" value="[04;38;5;111m"/>
Due to which jenkins throws error for invalid xml.
How can I remove properties from the generated xml.
Thanks in advance.
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="Sanity" tests="3" failures="3" errors="0" time="5.354">
<properties><property name="JOB_NAME" value="QA-API-Automation-Sanity"/>
<property name="java.vendor" value="Oracle Corporation"/><property name="PWD" value="/var/lib/jenkins"/><property name="sun.java.launcher" value="SUN_STANDARD"/><property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/><property name="PATH" value="/var/lib/jenkins/tools/chromedriver:/usr/local/bin:/bin:/usr/bin:/opt/aws/bin:/usr/lib/apache-maven-3.3.9/bin/"/><property name="JENKINS_HOME" value="/var/lib/jenkins"/><property name="AWS_SDK_LOAD_CONFIG" value="true"/><property name="HUDSON_SERVER_COOKIE" value="2567307d622fab24"/><property name="POM_ARTIFACTID" value="apitest"/><property name="os.name" value="Linux"/><property name="EXECUTOR_NUMBER" value="3"/><property name="sun.boot.class.path" value="/usr/java/jdk1.8.0_60/jre/lib/resources.jar:/usr/java/jdk1.8.0_60/jre/lib/rt.jar:/usr/java/jdk1.8.0_60/jre/lib/sunrsasign.jar:/usr/java/jdk1.8.0_60/jre/lib/jsse.jar:/usr/java/jdk1.8.0_60/jre/lib/jce.jar:/usr/java/jdk1.8.0_60/jre/lib/charsets.jar:/usr/java/jdk1.8.0_60/jre/lib/jfr.jar:/usr/java/jdk1.8.0_60/jre/classes"/><property name="POM_DISPLAYNAME" value="APITest"/><property name="java.vm.specification.vendor" value="Oracle Corporation"/><property name="ROOT_BUILD_CAUSE" value="MANUALTRIGGER"/><property name="NODE_LABELS" value="QA-Slave qa-slave"/><property name="java.runtime.version" value="1.8.0_60-b27"/><property name="user.name" value="jenkins"/><property name="SSH_CONNECTION" value="52.14.5.155 42186 10.0.0.142 22"/><property name="guice.disable.misplaced.annotation.check" value="true"/><property name="SSH_CLIENT" value="52.14.5.155 42186 22"/><property name="PYTHON_INSTALL_LAYOUT" value="amzn"/><property name="user.language" value="en"/><property name="RUN_CHANGES_DISPLAY_URL" value="https://jenkins.gl-poc.com/job/QA-API-Automation-Sanity/22/display/redirect?page=changes"/><property name="JOB_BASE_NAME" value="QA-API-Automation-Sanity"/><property name="BUILD_DISPLAY_NAME" value="#22"/><property name="sun.boot.library.path" value="/usr/java/jdk1.8.0_60/jre/lib/amd64"/><property name="AWS_AUTO_SCALING_HOME" value="/opt/aws/apitools/as"/><property name="java.version" value="1.8.0_60"/><property name="user.timezone" value="Etc/UTC"/><property name="sun.arch.data.model" value="64"/><property name="NODE_NAME" value="QA-Slave"/><property name="NLSPATH" value="/usr/dt/lib/nls/msg/%L/%N.cat"/><property name="java.endorsed.dirs" value="/usr/java/jdk1.8.0_60/jre/lib/endorsed"/><property name="BUILD_ID" value="22"/><property name="sun.cpu.isalist" value=""/><property name="sun.jnu.encoding" value="UTF-8"/><property name="file.encoding.pkg" value="sun.io"/><property name="SHELL" value="/bin/bash"/><property name="file.separator" value="/"/><property name="java.specification.name" value="Java Platform API Specification"/>
<property name="LESS_TERMCAP_us" value="[04;38;5;111m"/>
<property name="java.class.version" value="52.0"/><property name="org.slf4j.simpleLogger.defaultLogLevel" value="info"/><property name="user.country" value="US"/><property name="securerandom.source" value="file:/dev/./urandom"/><property name="java.home" value="/usr/java/jdk1.8.0_60/jre"/><property name="java.vm.info" value="mixed mode"/><property name="LESSOPEN" value="||/usr/bin/lesspipe.sh %s"/><property name="os.version" value="4.4.41-36.55.amzn1.x86_64"/><property name="EC2_AMITOOL_HOME" value="/opt/aws/amitools/ec2"/><property name="RUN_DISPLAY_URL" value="https://jenkins.gl-poc.com/job/QA-API-Automation-Sanity/22/display/redirect"/>
<property name="LESS_TERMCAP_ue" value="[0m"/><property name="POM_VERSION" value="1.0-SNAPSHOT"/><property name="sun.font.fontmanager" value="sun.awt.X11FontManager"/><property name="path.separator" value=":"/><property name="java.vm.version" value="25.60-b23"/><property name="GIT_PREVIOUS_COMMIT" value="c20674b0f57ce7beb1a881f19bdfeae2a5b602e7"/><property name="JOB_DISPLAY_URL" value="https://jenkins.gl-poc.com/job/QA-API-Automation-Sanity/display/redirect"/><property name="SHLVL" value="1"/><property name="_" value="/usr/bin/java"/><property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/><property name="JAVA_HOME" value="/usr/java/jdk1.8.0_60"/><property name="sun.io.unicode.encoding" value="UnicodeLittle"/><property name="awt.toolkit" value="sun.awt.X11.XToolkit"/><property name="LOGNAME" value="jenkins"/><property name="POM_PACKAGING" value="jar"/><property name="HOME" value="/home/jenkins"/><property name="POM_GROUPID" value="com.api"/><property name="user.home" value="/home/jenkins"/><property name="JENKINS_SERVER_COOKIE" value="2567307d622fab24"/><property name="BUILD_TAG" value="jenkins-QA-API-Automation-Sanity-22"/><property name="HUDSON_URL" value="https://jenkins.gl-poc.com/"/><property name="java.specification.vendor" value="Oracle Corporation"/><property name="CLASSPATH" value=""/><property name="java.library.path" value="/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib"/><property name="java.vendor.url" value="http://java.oracle.com/"/><property name="ROOT_BUILD_CAUSE_MANUALTRIGGER" value="true"/><property name="java.vm.vendor" value="Oracle Corporation"/><property name="maven.home" value="/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven3.3.9"/><property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/><property name="sun.java.command" value="jenkins.maven3.agent.Maven33Main /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven3.3.9 /var/lib/jenkins/slave.jar /var/lib/jenkins/maven33-interceptor.jar /var/lib/jenkins/maven3-interceptor-commons.jar 44390"/><property name="java.class.path" value="/var/lib/jenkins/maven33-agent.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven3.3.9/boot/plexus-classworlds-2.5.2.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven3.3.9/conf/logging"/><property name="EC2_HOME" value="/opt/aws/apitools/ec2"/><property name="java.vm.specification.name" value="Java Virtual Machine Specification"/><property name="java.vm.specification.version" value="1.8"/><property name="MAIL" value="/var/mail/jenkins"/><property name="M2_HOME" value="/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven3.3.9"/>
<property name="LESS_TERMCAP_me" value="[0m"/><property name="sun.cpu.endian" value="little"/><property name="sun.os.patch.level" value="unknown"/>
<property name="LESS_TERMCAP_md" value="[01;38;5;208m"/>
<property name="LESS_TERMCAP_mb" value="[01;31m"/>
<property name="java.io.tmpdir" value="/tmp"/><property name="PATH+MAVEN" value="/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven3.3.9/bin"/><property name="HUDSON_HOME" value="/var/lib/jenkins"/>
<property name="LESS_TERMCAP_se" value="[0m"/><property name="OLDPWD" value="/home/jenkins"/>
<property name="java.vendor.url.bug" value="http://bugreport.sun.com/bugreport/"/>
<property name="BUILD_URL" value="https://jenkins.gl-poc.com/job/QA-API-Automation-Sanity/22/"/>
<property name="os.arch" value="amd64"/><property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/><property name="java.ext.dirs" value="/usr/java/jdk1.8.0_60/jre/lib/ext:/usr/java/packages/lib/ext"/><property name="JOB_URL" value="https://jenkins.gl-poc.com/job/QA-API-Automation-Sanity/"/><property name="_JAVA_OPTIONS" value="-Xmx2048m"/><property name="user.dir" value="/var/lib/jenkins/workspace/QA-API-Automation-Sanity"/><property name="MAVEN_HOME" value="/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven3.3.9"/><property name="line.separator" value="
"/>
<property name="BUILD_NUMBER" value="22"/><property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/><property name="JENKINS_URL" value="https://jenkins.gl-poc.com/"/>
<property name="GIT_BRANCH" value="origin/develop"/><property name="PATH+CHROMEDRIVER" value="/var/lib/jenkins/tools/chromedriver"/><property name="BUILD_CAUSE_MANUALTRIGGER" value="true"/><property name="GIT_COMMIT" value="ad5e9221a4f489a8a60e60bed86061be514bccda"/><property name="LANG" value="en_US.UTF-8"/><property name="file.encoding" value="UTF-8"/><property name="maven3.interceptor" value="/var/lib/jenkins/maven33-interceptor.jar"/><property name="WORKSPACE" value="/var/lib/jenkins/workspace/QA-API-Automation-Sanity"/><property name="maven3.interceptor.common" value="/var/lib/jenkins/maven3-interceptor-commons.jar"/><property name="AWS_PATH" value="/opt/aws"/><property name="AWS_ELB_HOME" value="/opt/aws/apitools/elb"/><property name="AWS_CLOUDWATCH_HOME" value="/opt/aws/apitools/mon"/><property name="java.specification.version" value="1.8"/><property name="BUILD_CAUSE" value="MANUALTRIGGER"/><property name="USER" value="jenkins"/><property name="XFILESEARCHPATH" value="/usr/dt/app-defaults/%L/Dt"/><property name="GIT_URL" value="ssh://git#bitbucket.pearson.com/glpnfr/glp-api-automation-qa.git"/></properties>
<testcase name="Login" time="1.595">
<failure type="Failing due to failed test step" message="Failing due to failed test step">
<![CDATA[<h3><b>claimTokenIdTransfer Failed</b></h3><pre>Error performing transfer [claimTokenRetrieval] - Missing target property
</pre><hr/><h3><b>retrievalClaim Failed</b></h3><pre>[Valid HTTP Status Codes] Response status code:401 is not in acceptable list of status codes
</pre><hr/>]]>
</failure>
</testcase>
</testsuite>

Here you go, comments in-line:
Pass the xml as string to parseText method.
//Pass xml string
def pxml = new XmlSlurper().parseText(xml)
//Get the suites
def suites = pxml.'**'.findAll{ it.name() == 'testsuite' }
//Remove properties node
suites.each{ it.properties.replaceNode {} }
//This gives the new xml without properties element
def output = groovy.xml.XmlUtil.serialize(pxml)​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
//Below would unescape the xml
def map = ['<' : '<', '>' : '>', '"' : '"', '&apos;':'\'', '&':'&']
map.collect {k,v -> output = output.replaceAll(k,v)}
println output​
You can quickly try this online Demo

Related

ATU Reports throws NullPointerException

I am trying to use ATU Reports for my project. The suite has around 25 #Test methods. After the completion of execution, a null pointer exception is got.
Exception in thread "main" java.lang.IllegalStateException:
java.lang.NullPointe rException
at atu.testng.reports.listeners.ATUReportsListener.onFinish(Unknown Sour
ce)
at org.testng.SuiteRunner.invokeListeners(SuiteRunner.java:204)
at org.testng.SuiteRunner.run(SuiteRunner.java:264)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1048)
at org.testng.TestNG.privateMain(TestNG.java:1355)
at org.testng.TestNG.main(TestNG.java:1324) Caused by: java.lang.NullPointerException
at atu.testng.reports.writers.CurrentRunPageWriter.getTestCaseHTMLPath(U
nknown Source)
at atu.testng.reports.writers.CurrentRunPageWriter.writeFailedData(Unkno
wn Source)
at atu.testng.reports.writers.CurrentRunPageWriter.content(Unknown Sourc
e)
at atu.testng.reports.listeners.ATUReportsListener.generateCurrentRunPag
e(Unknown Source)
... 10 more
Another observation is that the ATU report is generated successfully when the #Test methods is around 5. Could it be that a particular #Test method is causing this NullPointerException?
testng.xml file is as below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
<test name="Test">
<groups>
<run>
<include name="A1" />
<include name="A2" />
<include name="B1" />
</run>
</groups>
<classes>
<class name="com.test.testcases.Class1"/>
<class name="com.test.testcases.Class2"/>
<class name="com.test.testcases.Class3"/>
</classes>
</test> <!-- Test -->
<listeners>
<listener class-name="atu.testng.reports.listeners.ATUReportsListener"></listener>
<listener class-name="atu.testng.reports.listeners.ConfigurationListener"></listener>
<listener class-name="atu.testng.reports.listeners.MethodListener"></listener>
</listeners>
</suite> <!-- Suite -->
Something is null in this code (decompiled from ATU 5.1.1):
public void onFinish(ISuite paramISuite)
{
try
{
this.iSuite = paramISuite;
String str1 = SettingsFile.get("passedList") + this.passedTests.size() + ';';
String str2 = SettingsFile.get("failedList") + this.failedTests.size() + ';';
String str3 = SettingsFile.get("skippedList") + this.skippedTests.size() + ';';
SettingsFile.set("passedList", str1);
SettingsFile.set("failedList", str2);
SettingsFile.set("skippedList", str3);
HTMLDesignFilesJSWriter.lineChartJS(str1, str2, str3, this.runCount);
HTMLDesignFilesJSWriter.barChartJS(str1, str2, str3, this.runCount);
HTMLDesignFilesJSWriter.pieChartJS(this.passedTests.size(), this.failedTests.size(), this.skippedTests.size(), this.runCount);
generateIndexPage();
paramISuite.setAttribute("endExecution", Long.valueOf(System.currentTimeMillis()));
long l = ((Long)paramISuite.getAttribute("startExecution")).longValue();
generateConsolidatedPage();
generateCurrentRunPage(l, System.currentTimeMillis());
startReportingForPassed(this.passedTests);
startReportingForFailed(this.failedTests);
startReportingForSkipped(this.skippedTests);
if (Directory.generateExcelReports) {
ExcelReports.generateExcelReport(Directory.RUNDir + Directory.SEP + "(" + Directory.REPORTSDIRName + ") " + Directory.RUNName + this.runCount + ".xlsx", this.passedTests, this.failedTests, this.skippedTests);
}
if (Directory.generateConfigReports) {
ConfigurationListener.startConfigurationMethodsReporting(this.runCount);
}
if (Directory.recordSuiteExecution) {
try
{
this.recorder.stop();
}
catch (Throwable localThrowable) {}
}
}
catch (Exception localException)
{
throw new IllegalStateException(localException);
}
}
I suspect the issue comes from long l = ((Long)paramISuite.getAttribute("startExecution")).longValue(); because TestNG has some issues with listeners.
What you should do is installing a java decompiler in your IDE (for example http://jd.benow.ca/). Then, in debug mode, you'll be able to find where exactly is the issue.
You should try the latest TestNG version (6.9.12) too which is supposed to fix the previous listener issues.
While debugging manually and running the classes individually I found out that one of the class was throwing a nullpointer exception as there was a mismatch in the number of parameters passed.

Unable to add a row to Solr

Im trying to add a row to the Solr Index but it does not get added.
I get a response but not sure what to infer from the response.
What information the response provides here? How do I get the exception?
>>> c = SolrConnection('http://localhost:8983/solr')
>>> c
<SolrConnection (url=http://localhost:8983/solr, persistent=True, post_headers={'Content-Type': 'text/xml; charset=utf-8'}, reconnects=0)>
>>> l = [{'document_type': 'demo', 'id': 'demo11234', 'deco_name': 'test'}]
>>> c.add_many(l)
'<?xml version="1.0" encoding="UTF-8"?>\n<response>\n<lst name="responseHeader"><int name="status">0</int><int name="QTime">1</int></lst>\n</response>\n'
>>> try:
... c.add_many(l)
... except:
... print "error"
...
'<?xml version="1.0" encoding="UTF-8"?>\n<response>\n<lst name="responseHeader"><int name="status">0</int><int name="QTime">2</int></lst>\n</response>\n'

XML XPath - Sub path

Using the following XML, in SQL Server how can I get a table of LineItemId,PetId(value),vetid(Value)? I'm stumped.
Basically, It should return:
255fa32c-dce6-4e7a-83a5-4b45f22f00fc 75866 12916
183dc279-53a6-45fc-9e75-57770582b6bc 34535 34546
From this XML:
<PurchaseOrder>
<OrderForms>
<OrderForm>
<LineItems>
<LineItem LineItemId="255fa32c-dce6-4e7a-83a5-4b45f22f00fc">
<WeaklyTypedProperties>
<WeaklyTypedProperty Name="petId" Value="75866" Type="String" />
<WeaklyTypedProperty Name="vetId" Value="12916" Type="String" />
</WeaklyTypedProperties>
</LineItem>
<LineItem LineItemId="183dc279-53a6-45fc-9e75-57770582b6bc">
<WeaklyTypedProperties>
<WeaklyTypedProperty Name="petId" Value="345345" Type="String" />
<WeaklyTypedProperty Name="vetId" Value="345346" Type="String" />
</WeaklyTypedProperties>
</LineItem>
</LineItems>
</OrderForm>
</OrderForms>
</PurchaseOrder>
I should state I have tried the following, but it gives blanks for petId and vetId:
SELECT
p.value('#LineItemId','NVARCHAR(100)')
,p.query('//PurchaseOrder/OrderForms/OrderForm[1]/LineItems/LineItem[1]/WeaklyTypedProperties/WeaklyTypedProperty[Name="petId"]')
,p.query('//PurchaseOrder/OrderForms/OrderForm[1]/LineItems/LineItem[1]/WeaklyTypedProperties/WeaklyTypedProperty[Name="vetid"]')
FROM
dbo.[PurchaseOrdersMarshalledData] pomd
CROSS APPLY pomd.[MarshalledData].nodes('//PurchaseOrder/OrderForms/OrderForm[1]/LineItems/LineItem') x(p)
Thanks!
SELECT
[LineItemId] = l.value('#LineItemId', 'nvarchar(100)'),
[PetId] = w.value('WeaklyTypedProperty[#Name="petId"][1]/#Value', 'int'),
[VetId] = w.value('WeaklyTypedProperty[#Name="vetId"][1]/#Value', 'int')
FROM dbo.[PurchaseOrdersMarshalledData] pomp
CROSS APPLY pomp.[MarshalledData].nodes('//PurchaseOrder/OrderForms/OrderForm[1]/LineItems/LineItem') LineItem(l)
CROSS APPLY l.nodes('WeaklyTypedProperties') WeaklyTypedProperty(w)
Haven't tried it... maybe the syntaxis is not 100% correct...
<xsl:for-each select="/PurcharseOrder/OrderForms/OrderForm/LineItems/LineItem"/>
<xsl:value-of select="#LineItemId"/>
<xsl:for-each select="WeaklyTypedProperties"/>
<xsl:value-of select="WeaklyTypedProperty/#Value"/>
</xsl:for-each>
</xsl:for-each>

jbossws webservice throwing exception from another spring based application

I have picked an example from jboss ‘helloworld-ws’. I created a client spring based web application helloworld-ws-test. Then I created a webservice client through jboss webservice client (it also create one sample client with main method).
I deploy both applications in jboss 6.1-eap server. So if I try to access the webservice through sample client I am getting the output without any problem but when I copy the same code into helloworld-ws-test web application controller and try to access webservice I am getting the following exception.
11:51:55,025 DEBUG [org.springframework.web.servlet.DispatcherServlet] (http-localhost/127.0.0.1:8080-1) Could not complete request: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:149)
at org.jboss.wsf.stack.cxf.client.ProviderImpl$JBossWSServiceImpl.<init>(ProviderImpl.java:479)
at org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(ProviderImpl.java:165)
at javax.xml.ws.Service.<init>(Service.java:57) [jboss-jaxws-api_2.2_spec-2.0.1.Final-redhat-2.jar:2.0.1.Final-redhat-2]
at org.jboss.jbossas.quickstarts.wshelloworld.helloworld.HelloWorldService_Service.<init>(HelloWorldService_Service.java:47) [classes:]
at org.jboss.as.quickstarts.mvc.MemberController.displaySortedMembers(MemberController.java:20) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213) [spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126) [spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96) [spring-webmvc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617) [spring-webmvc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578) [spring-webmvc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) [spring-webmvc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) [spring-webmvc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) [spring-webmvc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) [spring-webmvc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) [spring-webmvc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09]
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:100)
at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:203)
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:147)
... 36 more
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF; was expecting a close tag for element <HTML>
at [row,col,system-id]: [4,0,"http://localhost:8080/helloworld-ws/HelloWorldService?wsdl"]
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:243)
at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:192)
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:98)
... 38 more
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF; was expecting a close tag for element <HTML>
at [row,col,system-id]: [4,0,"http://localhost:8080/helloworld-ws/HelloWorldService?wsdl"]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:677)
at com.ctc.wstx.sr.BasicStreamReader.throwUnexpectedEOF(BasicStreamReader.java:5532)
at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2720)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1072)
at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:1250)
at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:1144)
at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:1071)
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:234)
... 40 more
11:51:55,037 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/helloworld-ws-test].[jboss-as-kitchensink]] (http-localhost/127.0.0.1:8080-1) JBWEB000236: Servlet.service() for servlet jboss-as-kitchensink threw exception: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF; was expecting a close tag for element <HTML>
at [row,col,system-id]: [4,0,"http://localhost:8080/helloworld-ws/HelloWorldService?wsdl"]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:677)
at com.ctc.wstx.sr.BasicStreamReader.throwUnexpectedEOF(BasicStreamReader.java:5532)
at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2720)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1072)
at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:1250)
at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:1144)
at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:1071)
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:234)
at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:192)
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:98)
at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:203)
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:147)
at org.jboss.wsf.stack.cxf.client.ProviderImpl$JBossWSServiceImpl.<init>(ProviderImpl.java:479)
at org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(ProviderImpl.java:165)
at javax.xml.ws.Service.<init>(Service.java:57) [jboss-jaxws-api_2.2_spec-2.0.1.Final-redhat-2.jar:2.0.1.Final-redhat-2]
at org.jboss.jbossas.quickstarts.wshelloworld.helloworld.HelloWorldService_Service.<init>(HelloWorldService_Service.java:47) [classes:]
at org.jboss.as.quickstarts.mvc.MemberController.displaySortedMembers(MemberController.java:20) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213) [spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126) [spring-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96) [spring-webmvc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617) [spring-webmvc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578) [spring-webmvc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) [spring-webmvc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) [spring-webmvc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) [spring-webmvc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) [spring-webmvc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) [spring-webmvc-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09]
WSDL
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.jboss.org/jbossas/quickstarts/wshelloworld/HelloWorld" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="HelloWorldService" targetNamespace="http://www.jboss.org/jbossas/quickstarts/wshelloworld/HelloWorld">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.jboss.org/jbossas/quickstarts/wshelloworld/HelloWorld" elementFormDefault="unqualified" targetNamespace="http://www.jboss.org/jbossas/quickstarts/wshelloworld/HelloWorld" version="1.0">
<xs:element name="sayHello" type="tns:sayHello"/>
<xs:element name="sayHelloResponse" type="tns:sayHelloResponse"/>
<xs:element name="sayHelloToName" type="tns:sayHelloToName"/>
<xs:element name="sayHelloToNameResponse" type="tns:sayHelloToNameResponse"/>
<xs:element name="sayHelloToNames" type="tns:sayHelloToNames"/>
<xs:element name="sayHelloToNamesResponse" type="tns:sayHelloToNamesResponse"/>
<xs:complexType name="sayHello">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="sayHelloResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="sayHelloToNames">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="arg0" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="sayHelloToNamesResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="sayHelloToName">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="sayHelloToNameResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="sayHelloToNameResponse">
<wsdl:part element="tns:sayHelloToNameResponse" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="sayHelloToNamesResponse">
<wsdl:part element="tns:sayHelloToNamesResponse" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="sayHelloToName">
<wsdl:part element="tns:sayHelloToName" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="sayHelloToNames">
<wsdl:part element="tns:sayHelloToNames" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="sayHelloResponse">
<wsdl:part element="tns:sayHelloResponse" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="sayHello">
<wsdl:part element="tns:sayHello" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:portType name="HelloWorldService">
<wsdl:operation name="sayHello">
<wsdl:input message="tns:sayHello" name="sayHello"></wsdl:input>
<wsdl:output message="tns:sayHelloResponse" name="sayHelloResponse"></wsdl:output>
</wsdl:operation>
<wsdl:operation name="sayHelloToNames">
<wsdl:input message="tns:sayHelloToNames" name="sayHelloToNames"></wsdl:input>
<wsdl:output message="tns:sayHelloToNamesResponse" name="sayHelloToNamesResponse"></wsdl:output>
</wsdl:operation>
<wsdl:operation name="sayHelloToName">
<wsdl:input message="tns:sayHelloToName" name="sayHelloToName"></wsdl:input>
<wsdl:output message="tns:sayHelloToNameResponse" name="sayHelloToNameResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloWorldServiceSoapBinding" type="tns:HelloWorldService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayHello">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="sayHello">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="sayHelloResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="sayHelloToNames">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="sayHelloToNames">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="sayHelloToNamesResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="sayHelloToName">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="sayHelloToName">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="sayHelloToNameResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="HelloWorldService">
<wsdl:port binding="tns:HelloWorldServiceSoapBinding" name="HelloWorld">
<soap:address location="http://localhost:8080/helloworld-ws/HelloWorldService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
HelloWorldService.java
/*
* JBoss, Home of Professional Open Source
* Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
* contributors by the #authors tag. See the copyright.txt in the
* distribution for a full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.as.quickstarts.wshelloworld;
import java.util.List;
import javax.jws.WebMethod;
import javax.jws.WebService;
/**
* A simple example of how to setup a JAX-WS Web Service. It can say hello to everyone or to someone in particular.
*
* #author lnewson#redhat.com
*/
#WebService(targetNamespace = "http://www.jboss.org/jbossas/quickstarts/wshelloworld/HelloWorld")
public interface HelloWorldService {
/**
* Say hello as a response
*
* #return A simple hello world message
*/
#WebMethod
public String sayHello();
/**
* Say hello to someone precisely
*
* #param name The name of the person to say hello to
* #return the number of current bookings
*/
#WebMethod
public String sayHelloToName(String name);
/**
* Say hello to a list of people
*
* #param names The list of names to say hello to
* #return the number of current bookings
*/
#WebMethod
public String sayHelloToNames(List<String> names);
}
HelloWorldServiceImpl.java
/*
* JBoss, Home of Professional Open Source
* Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
* contributors by the #authors tag. See the copyright.txt in the
* distribution for a full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.as.quickstarts.wshelloworld;
import java.util.ArrayList;
import java.util.List;
import javax.jws.WebService;
/**
* The implementation of the HelloWorld JAX-WS Web Service.
*
* #author lnewson#redhat.com
*/
#WebService(serviceName = "HelloWorldService", portName = "HelloWorld", name = "HelloWorld", endpointInterface = "org.jboss.as.quickstarts.wshelloworld.HelloWorldService", targetNamespace = "http://www.jboss.org/jbossas/quickstarts/wshelloworld/HelloWorld")
public class HelloWorldServiceImpl implements HelloWorldService {
#Override
public String sayHello() {
return "Hello World!";
}
#Override
public String sayHelloToName(final String name) {
/* Create a list with just the one value */
final List<String> names = new ArrayList<String>();
names.add(name);
return sayHelloToNames(names);
}
#Override
public String sayHelloToNames(final List<String> names) {
return "Hello " + createNameListString(names);
}
/**
* Creates a list of names separated by commas or an and symbol if its the last separation. This is then used to say hello to
* the list of names.
*
* i.e. if the input was {John, Mary, Luke} the output would be John, Mary & Luke
*
* #param names A list of names
* #return The list of names separated as described above.
*/
private String createNameListString(final List<String> names) {
/*
* If the list is null or empty then assume the call was anonymous.
*/
if (names == null || names.isEmpty()) {
return "Anonymous!";
}
final StringBuilder nameBuilder = new StringBuilder();
for (int i = 0; i < names.size(); i++) {
/*
* Add the separator if its not the first string or the last separator since that should be an and (&) symbol.
*/
if (i != 0 && i != names.size() - 1)
nameBuilder.append(", ");
else if (i != 0 && i == names.size() - 1)
nameBuilder.append(" & ");
nameBuilder.append(names.get(i));
}
nameBuilder.append("!");
return nameBuilder.toString();
}
}
ClientSample.java
package org.jboss.jbossas.quickstarts.wshelloworld.helloworld.clientsample;
import org.jboss.jbossas.quickstarts.wshelloworld.helloworld.*;
public class ClientSample {
public static void main(String[] args) {
System.out.println("***********************");
System.out.println("Create Web Service Client...");
HelloWorldService_Service service1 = new HelloWorldService_Service();
System.out.println("Create Web Service...");
HelloWorldService port1 = service1.getHelloWorld();
System.out.println("Call Web Service Operation...");
System.out.println("Server said: " + port1.sayHello());
System.out.println("Server said: " + port1.sayHelloToNames(null));
//Please input the parameters instead of 'null' for the upper method!
System.out.println("Server said: " + port1.sayHelloToName(null));
//Please input the parameters instead of 'null' for the upper method!
System.out.println("Create Web Service...");
HelloWorldService port2 = service1.getHelloWorld();
System.out.println("Call Web Service Operation...");
System.out.println("Server said: " + port2.sayHello());
System.out.println("Server said: " + port2.sayHelloToNames(null));
//Please input the parameters instead of 'null' for the upper method!
System.out.println("Server said: " + port2.sayHelloToName(null));
//Please input the parameters instead of 'null' for the upper method!
System.out.println("***********************");
System.out.println("Call Over!");
}
}
MemberController.java
package org.jboss.as.quickstarts.mvc;
import org.jboss.jbossas.quickstarts.wshelloworld.helloworld.HelloWorldService;
import org.jboss.jbossas.quickstarts.wshelloworld.helloworld.HelloWorldService_Service;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
#Controller
#RequestMapping(value = "/")
public class MemberController {
#RequestMapping(method=RequestMethod.GET)
public String displaySortedMembers(Model model) {
System.out.println("***********************");
System.out.println("Create Web Service Client...");
HelloWorldService_Service service1 = new HelloWorldService_Service();
System.out.println("Create Web Service...");
HelloWorldService port1 = service1.getHelloWorld();
System.out.println("Call Web Service Operation...");
System.out.println("Server said: " + port1.sayHello());
System.out.println("Server said: " + port1.sayHelloToNames(null));
//Please input the parameters instead of 'null' for the upper method!
System.out.println("Server said: " + port1.sayHelloToName(null));
//Please input the parameters instead of 'null' for the upper method!
System.out.println("Create Web Service...");
HelloWorldService port2 = service1.getHelloWorld();
System.out.println("Call Web Service Operation...");
System.out.println("Server said: " + port2.sayHello());
System.out.println("Server said: " + port2.sayHelloToNames(null));
//Please input the parameters instead of 'null' for the upper method!
System.out.println("Server said: " + port2.sayHelloToName(null));
//Please input the parameters instead of 'null' for the upper method!
System.out.println("***********************");
System.out.println("Call Over!");
return "index";
}
}
Did you put all the necessary jar files in your client. Please check out first and then check out your cxf jar file version for comfortable. Make sure you have defined the correct wsdl name (e.g "http: //something:7101/TestWSA/WsaWebServiceTest?WSDL") in your client class. Note, Check out your jar files version first. I think, it will work. Thanks!

Delete XML nodes in SQL server based on conditions

I have xml that looks like
<MeasureSet>
<MeasureSetType val_type="name">Variant</MeasureSetType>
<Measure>
<MeasureType val_type="name">single nucleotide variant</MeasureType>
<AttributeSet>
<MeasureAttributeType val_type="name">HGVS</MeasureAttributeType>
<Attribute>NM_000054.4:c.838dupT</Attribute>
</AttributeSet>
<Citation>
<CitationType val_type="name">general</CitationType>
<ID Source="PubMed">10820168</ID>
</Citation>
<Citation>
<CitationType val_type="name">general</CitationType>
<ID Source="PubMed" />
</Citation>
<Citation>
<CitationType val_type="name">general</CitationType>
<ID Source="PubMed">9773787</ID>
</Citation>
<Citation>
<CitationType val_type="name">general</CitationType>
<ID Source="PubMed">18726898</ID>
</Citation>
<Citation>
<CitationType val_type="name">general</CitationType>
<ID Source="PubMed" />
</Citation>
</Measure>
</MeasureSet>
I want to delete the Citation element nodes that have Citation/ID/#Source = "PubMed" and Citation/ID is empty
This deletes only the ID element, but the correct ones
SET #myBlob.modify('delete //Citation/ID[#Source = ''PubMed''
and string-length(string(number(.))) = 0]')
and this deletes all Citation elements
SET #myBlob.modify('delete //Citation[ID/#Source = ''PubMed''
and string-length(string(number(.))) = 0]')
Seems there should be an easy solution I'm not hitting on. Any suggestions? Thanks
Your second one is checking the length of the wrong element - it's looking at (.), which is here the Citation element (because it's in a predicate on the Citation element). Use instead
SET #myBlob.modify('
delete //Citation[ID/#Source = ''PubMed''
and string-length(string(number(ID[1]))) = 0]')
where I have changed . to ID[1]. The [1] is needed because "'number()' requires a singleton (or empty sequence)".

Resources