I'm a beginner in Protege / OWL and I'm having trouble understanding why max cardinality is working and min cardinality is not.
I tried Hermit Pellet and Fact as reasoners. I know about the Open World Assumtion, but this seems not logical to me.
I want to express that there must be at least 2 Persons in a Marriage event.
Class: MarriageEvent
EquivalentTo:
This works:
MarriageEvent and is_event_of max 2 Person
And this not:
MarriageEvent and is_event_of min 2 Person
All individuals are declared as different individuals.
My ontology:
<?xml version="1.0"?>
<Ontology xmlns="http://www.w3.org/2002/07/owl#"
xml:base="http://www.semanticweb.org/anato/ontologies/2017/7/untitled-ontology-184"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
ontologyIRI="http://www.semanticweb.org/anato/ontologies/2017/7/untitled-ontology-184">
<Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
<Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
<Prefix name="xml" IRI="http://www.w3.org/XML/1998/namespace"/>
<Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
<Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
<Declaration>
<NamedIndividual IRI="#Peter"/>
</Declaration>
<Declaration>
<NamedIndividual IRI="#Julia"/>
</Declaration>
<Declaration>
<ObjectProperty IRI="#is_event_of"/>
</Declaration>
<Declaration>
<NamedIndividual IRI="#Max"/>
</Declaration>
<Declaration>
<Class IRI="#Person"/>
</Declaration>
<Declaration>
<NamedIndividual IRI="#Event_Marriage"/>
</Declaration>
<Declaration>
<Class IRI="#MarriageEvent"/>
</Declaration>
<EquivalentClasses>
<Class IRI="#MarriageEvent"/>
<ObjectIntersectionOf>
<Class IRI="#MarriageEvent"/>
<ObjectMinCardinality cardinality="2">
<ObjectProperty IRI="#is_event_of"/>
<Class IRI="#Person"/>
</ObjectMinCardinality>
</ObjectIntersectionOf>
</EquivalentClasses>
<EquivalentClasses>
<Class IRI="#MarriageEvent"/>
<ObjectIntersectionOf>
<Class IRI="#MarriageEvent"/>
<ObjectMaxCardinality cardinality="2">
<ObjectProperty IRI="#is_event_of"/>
<Class IRI="#Person"/>
</ObjectMaxCardinality>
</ObjectIntersectionOf>
</EquivalentClasses>
<DisjointClasses>
<Class IRI="#MarriageEvent"/>
<Class IRI="#Person"/>
</DisjointClasses>
<ClassAssertion>
<Class IRI="#MarriageEvent"/>
<NamedIndividual IRI="#Event_Marriage"/>
</ClassAssertion>
<ClassAssertion>
<Class IRI="#Person"/>
<NamedIndividual IRI="#Julia"/>
</ClassAssertion>
<ClassAssertion>
<Class IRI="#Person"/>
<NamedIndividual IRI="#Max"/>
</ClassAssertion>
<ClassAssertion>
<Class IRI="#Person"/>
<NamedIndividual IRI="#Peter"/>
</ClassAssertion>
<DifferentIndividuals>
<NamedIndividual IRI="#Event_Marriage"/>
<NamedIndividual IRI="#Julia"/>
<NamedIndividual IRI="#Max"/>
<NamedIndividual IRI="#Peter"/>
</DifferentIndividuals>
<ObjectPropertyAssertion>
<ObjectProperty IRI="#is_event_of"/>
<NamedIndividual IRI="#Event_Marriage"/>
<NamedIndividual IRI="#Julia"/>
</ObjectPropertyAssertion>
<ObjectPropertyAssertion>
<ObjectProperty IRI="#is_event_of"/>
<NamedIndividual IRI="#Event_Marriage"/>
<NamedIndividual IRI="#Peter"/>
</ObjectPropertyAssertion>
<SubObjectPropertyOf>
<ObjectProperty IRI="#is_event_of"/>
<ObjectProperty abbreviatedIRI="owl:topObjectProperty"/>
</SubObjectPropertyOf>
<IrreflexiveObjectProperty>
<ObjectProperty IRI="#is_event_of"/>
</IrreflexiveObjectProperty>
<ObjectPropertyDomain>
<ObjectProperty IRI="#is_event_of"/>
<Class IRI="#MarriageEvent"/>
</ObjectPropertyDomain>
<ObjectPropertyRange>
<ObjectProperty IRI="#is_event_of"/>
<Class IRI="#Person"/>
</ObjectPropertyRange>
</Ontology>
<!-- Generated by the OWL API (version 4.2.8.20170104-2310) https://github.com/owlcs/owlapi -->
min 2 Person will not complain about marriages where only one person is known because of the Open World Assumption. Just because the second party to the wedding is not known, does not mean that it's not there.
Semantic Web languages such as OWL make the open-world assumption. The
absence of a particular statement within the web means, in principle,
that the statement has not been made explicitly yet, irrespective of
whether it would be true or not, and irrespective of whether we
believe that it would be true or not. In essence, from the absence of
a statement alone, a deductive reasoner cannot (and must not) infer
that the statement is false.
https://en.wikipedia.org/wiki/Open-world_assumption
The absence of a statement about the presence of a 2nd individual does not imply there is not a 2nd individual.
Related
Can you please help me with this? I have thousands of xml files like this:
<eolresult>
<eolpresetting>
<datetime>04.06.2021 15:26:20</datetime>
<order id="3I6LAKPVSLXSK316_FLX101xxxxxxxxxxxxxx000SK35X3PN9P40006C24A4NORL0L7P1XVV0008I96T24D3ZZF0006A0LTS0000"/>
</eolpresetting>
<testresult>IO</testresult>
<results>
<!-- PRN="3I6LAKPVSLXSK316_FLX101xxxxxxxxxxxxxx000SK35X3PN9P40006C24A4NORL0L7P1XVV0008I96T24D3ZZF0006A0LTS0000" -->
<test name="Airbag SAB">
<value name="Measured value - Generator">2,151977</value>
<value name="Low limit - Generator">1,74</value>
<value name="High limit - Generator">2,46</value>
<value name="Measured value - Break contact 1">5,079372</value>
<value name="Minumum value - Break contact 1">1,73</value>
<value name="Measured value - Break contact 2">5,104009</value>
<value name="Minumum value - Break contact 2">1,73</value>
<value name="Test OK">True</value>
</test>
<test name="Airbag CAB">
<value name="Measured value - Generator">2,131677</value>
<value name="Low limit - Generator">1,74</value>
<value name="High limit - Generator">2,26</value>
<value name="Measured value - Break contact 1">5,061298</value>
<value name="Minumum value - Break contact 1">1,73</value>
<value name="Measured value - Break contact 2">5,094279</value>
<value name="Minumum value - Break contact 2">1,73</value>
<value name="Test OK">True</value>
</test>
<test name="Heating">
<value name="Measured value">1,34909</value>
<value name="Low limit">1,22</value>
<value name="High limit">1,72</value>
<value name="Test OK">True</value>
</test>
<test name="SBR">
<value name="Measured value - Low force">399,8799</value>
<value name="Low limit - Low force">332</value>
<value name="High limit - Low force">468</value>
<value name="Measured value - Low force - Force [kg]">5,176686</value>
<value name="Low limit - Low force - Force [kg]">5,1</value>
<value name="High limit - Low force - Force [kg]">6,4</value>
<value name="Regulator Active - Low force">True</value>
<value name="Measured value - High force">100,0365</value>
<value name="Low limit - High force">83</value>
<value name="High limit - High force">117</value>
<value name="Measured value - High force - Force [kg]">33,72532</value>
<value name="Low limit - High force - Force [kg]">33,6</value>
<value name="High limit - High force - Force [kg]">34,3</value>
<value name="Regulator Active - High force">True</value>
<value name="Strain Gauge - Tare [kg]">-10,68025</value>
<value name="Test OK">True</value>
</test>
<test name="Headrests">
<value name="Force - Measured">16,61965</value>
<value name="Force - Low Limit">15,81</value>
<value name="Force - High Limit">17,64</value>
<value name="Regulator Active">True</value>
<value name="Strain Gauge - Tare [kg]">-8,725739E-02</value>
<value name="Test OK">True</value>
</results>
</eolresult>
And I would like to import this data into a SQL Server database into separate tables, defined by the "test name" which every tables should contain order id.
I tried to follow some guides on the internet but without success.
Thank you so much
How can I query an inverse of an object property using a reasoner?
For example, a Person can have a Gun and vice versa:
<Declaration>
<ObjectProperty IRI="#hasOwner"/>
</Declaration>
<Declaration>
<ObjectProperty IRI="#hasGun"/>
</Declaration>
<InverseObjectProperties>
<ObjectProperty IRI="#hasOwner"/>
<ObjectProperty IRI="#hasGun"/>
</InverseObjectProperties>
Because there are simple axioms, I tried to come up with an uncomplicatedstar function to handle this:
OWLObjectProperty getOWLInverseRelation(OWLReasoner reasoner, OWLObjectProperty relation) {
Set<OWLObjectPropertyExpression> inverseRelationExprs = reasoner.getInverseObjectProperties(relation).getEntities();
if (inverseRelationExprs.size() != 2) return null;
Iterator<OWLObjectPropertyExpression> inverseRelationExprIter = inverseRelationExprs.iterator();
OWLObjectPropertyExpression inverseRelationExpr = inverseRelationExprIter.next();
if (inverseRelationExpr.getNamedProperty().getIRI().getShortForm().equals(relation.getIRI().getShortForm()))
inverseRelationExpr = inverseRelationExprIter.next();
return inverseRelationExpr.asOWLObjectProperty();
}
Is this function a straightforward and simple way to get an inverse object property?
The OWLObjectPropertyExpression instances returned by reasoner.getInverseObjectProperties(relation).getEntities() are already the inverses of relation. Each one of them is inferred to be an inverse of your input - they can be equivalent to each other.
In the following xml the first three digits of "number"can be used to group "number" elements in resulted output. However I have no Idea how ?
Please see the input XML and my desired output bellow
Input
[see the input and the desired output][1]
<data>
<InputElemenmts>
<Element11>
<key>73004</key>
<number>001001</number>
</Element11>
<Element11>
<key>7300465</key>
<number>002001</number>
</Element11>
<Element11>
<key>730046</key>
<number>003001</number>
</Element11>
<Element11>
<key>730046</key>
<number>003002</number>
</Element11>
<Element11>
<key>730046</key>
<number>003003</number>
</Element11>
<Element11>
<key>730049</key>
<number>004001</number>
</Element11>
<Element11>
<key>730046</key>
<number>005001</number>
</Element11>
<Element11>
<key>730040</key>
<number>006001</number>
</Element11>
<Element11>
<key>730040</key>
<number>006002</number>
</Element11>
<Element11>
<key>730041</key>
<number>007001</number>
</Element11>
<Element11>
<key>730042</key>
<number>008001</number>
</Element11>
</InputElemenmts>
<OutputElemenmts>
<result>
<key>7300462</key>
<number>001001</number>
</result>
<result>
<key>7300465</key>
<number>002001</number>
</result>
<result>
<key>73004</key>
<Element>
<number>003001</number>
<number>003002</number>
<number>003003</number>
</Element>
</result>
<result>
<key>730049</key>
<number>004001</number>
</result>
<result>
<key>730046</key>
<number>005001</number>
</result>
<result>
<key>730040</key>
<Element>
<number>006001</number>
<number>006002</number>
</Element>
</result>
<result>
<key>730041</key>
<number>007001</number>
</result>
<result>
<key>730042</key>
<number>008001</number>
</result>
</OutputElemenmts>
This is what I've understood but probably not what you wanted??
<!-- find the last of Element11 with any key -->
<xsl:template match="Element11[not(following::Element11[key = current()/key])]">
<result>
<key><xsl:value-of select="key"/></key>
<xsl:choose>
<!-- are there more than one with this key? -->
<xsl:when test="preceding-sibling::Element11[key = current()/key]">
<!-- if yes it seems you want an Element wrapper -->
<Element>
<xsl:for-each select="preceding-sibling::Element11[key = current()/key]/number">
<number><xsl:value-of select="."/></number>
</xsl:for-each>
<!-- the current one -->
<number><xsl:value-of select="number"/></number>
</Element>
</xsl:when>
<xsl:otherwise>
<!-- only the current one -->
<number><xsl:value-of select="number"/></number>
</xsl:otherwise>
</xsl:choose>
</result>
</xsl:template>
<xsl:template match="Element11"/>
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.
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!