by Nikolai Dimitrov.
Hello,
I am trying to create new user using this(https://github.com/bantonia/MoodleRest) code. Ive created user and i am trying to call __createUsers
from MoodleRestUser and i am getting:
"[Fatal Error] :2:10: Already seen doctype.
Jun 07, 2019 11:54:26 PM net.beaconhillcott.moodlerest.MoodleCallRestWebService __call
SEVERE: null
org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 10; Already seen doctype.
at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:261)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathImplUtil.getDocument(XPathImplUtil.java:129)
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:180)
at net.beaconhillcott.moodlerest.MoodleCallRestWebService.__call(MoodleCallRestWebService.java:386)
at net.beaconhillcott.moodlerest.MoodleRestUser.__createUsers(MoodleRestUser.java:165)
at net.beaconhillcott.moodlerest.MoodleRestUser.__createUser(MoodleRestUser.java:55)
at Test.main(Test.java:52)
--------------- linked to ------------------
javax.xml.xpath.XPathExpressionException: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 10; Already seen doctype.
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathImplUtil.getDocument(XPathImplUtil.java:131)
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:180)
at net.beaconhillcott.moodlerest.MoodleCallRestWebService.__call(MoodleCallRestWebService.java:386)
at net.beaconhillcott.moodlerest.MoodleRestUser.__createUsers(MoodleRestUser.java:165)
at net.beaconhillcott.moodlerest.MoodleRestUser.__createUser(MoodleRestUser.java:55)
at Test.main(Test.java:52)
Caused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 10; Already seen doctype.
at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:261)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathImplUtil.getDocument(XPathImplUtil.java:129)
... 5 more"
My code is:
public static void main(String[] args) throws ProtocolException, IOException, MoodleRestUserException, MoodleRestException {
String token = "93ec5f7001a84j64c7b2563ce1998e31";
String domainName = "http://localhost/moodle/";
MoodleUser mu = new MoodleUser("javauser","Password","Testcho","Testov","mailche@mail.com");
mu.setAuth("manual");
mu.setIdNumber("test1");
MoodleRestUser mru = new MoodleRestUser();
mru.__createUser(domainName, token, mu); }
With another example i have created user and i thats why i am sure that my token is valid and moodle can handle that call. Thanks in advance for the help.