I have successfully written my first SOAP client in and I can get the
session_id and parse it. However when I am sending the loginuser
request I recieve and error -10 Not able to find username even though
it is hardcoded within the soap request. The error code comes back is
null. My Code is included for the soap request: and error handler:
I am submittig this here because it is not vb specific:
sub getSessionID
Dim objXMLHTTP : set objXMLHTTP = Server.CreateObject("Msxml2.XMLHTTP.
3.0")
Dim strRequest, strResult, strFunction, strURL, strNamespace,
bXMLLoadError
'URL to SOAP namespace and connection URL
strNamespace = "UserService"
strURL = "http://localhost:5080/openmeetings/services/UserService/
getSession"
'function you want to call
strFunction = "getSession"
'strFunction = "test" 'no parameters required
strRequest ="<?xml version=""1.0"" encoding=""utf-8""
standalone=""no""?>" _
& "<SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://www.w3.org/2003/05/soap-
envelope"" xmlns:SOAP-ENC=""http://schemas.xmlsoap.org/soap/
encoding/""" _
& " xmlns:wsdl=""http://schemas.xmlsoap.org/wsdl/""
xmlns:ns2=""http://services.axis.openmeetings.org""" _
& " xmlns:ns1=""http://basic.beans.data.app.openmeetings.org/
xsd"" xmlns:wsaw=""http://www.w3.org/2006/05/addressing/wsdl""" _
& " xmlns:http=""http://schemas.xmlsoap.org/wsdl/http/""
xmlns:ns0=""http://basic.beans.hibernate.app.openmeetings.org/xsd""" _
& " xmlns:xs=""http://www.w3.org/2001/XMLSchema""
xmlns:mime=""http://schemas.xmlsoap.org/wsdl/mime/""
xmlns:soap=""http://schemas.xmlsoap.org/wsdl/soap/""" _
& " xmlns:soap12=""http://schemas.xmlsoap.org/wsdl/soap12/""
xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">" _
& " <SOAP-ENV:Body>" _
& " <m:" & strFunction & " xmlns:m=""" & strNamespace & """>" _
& " </m:" & strFunction & ">" _
& " </SOAP-ENV:Body>" _
& "</SOAP-ENV:Envelope>"
objXMLHTTP.open "post", "" & strURL & "", False
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strRequest)
'objXMLHTTP.setRequestHeader "SOAPAction", "http://
216.161.170.249:5080/openmeetings/services/UserService/getSession"
'send the request and capture the result
objXMLHTTP.send(strRequest)
If objXMLHTTP.Status = 200 Then
strResult = objXMLHTTP.responseText
response.write strResult
session("sid") = mid(strResult,495,32)
'response.write "sid = "&session("sid")&"<BR>"
bXMLLoadError = False
Else
Response.Write("<font color=""red"">Page Error: Could not load XML
from remote server</font><br>") 'Show error message
bXMLLoadError = True
End If
If objXMLHTTP.status = 200 Then
If Not objXMLHTTP.responseXML Is Nothing And _
Not objXMLHTTP.responseXML.documentElement Is Nothing And _
objXMLHTTP.responseXML.parseError.errorCode <> 0 Then
Set ResponseXML = objXMLHTTP.responseXML
WellFormed = True
Else
Set ResponseXML = Server.CreateObject("Msxml2.DOMDocument.3.0")
ResponseXML.async = False
WellFormed = ResponseXML.load(objXMLHTTP.responseStream)
End If
If WellFormed Then
' Response.Write "<p>Got XML document with " & _
' ResponseXML.getElementsByTagName("*").length & _
' " elements</p>" & VbCrLf
'***************added by Me **********************
Dim str
str = ""
Set objNodeList = ResponseXML.getElementsByTagName("*")
For i = 0 To (objNodeList.length - 1)
str = objNodeList.Item(i).xml & vbCrLf
if i = 7 then
sessionid = mid(str,87,32)
session("sid")= sessionid
response.write "<BR>sessionid = "&sessionid&"<BR>"
end if
'response.write i&" = "&str &"<BR>"
Next
Else
Response.Write "<p>Parsing failed: " & _
ResponseXML.parseError.reason & _
"</p>" & VbCrLf
End If
Else
Response.Write "<p>HTTP status: " & _
objXMLHTTP.status & " " & _
objXMLHTTP.statusText & _
"</p>" & VbCrLf
End If
Set objXMLHTTP = nothing
set ResponseXML = nothing
call loginUser
end sub
"" RETURNS THE SID CORRECTLY
sub loginUser()
dim sid
Dim objXMLHTTP : set objXMLHTTP = Server.CreateObject("Msxml2.XMLHTTP.
3.0")
Dim strRequest, strResult, strFunction, strURL, strNamespace
sid = session("sid")
'URL to SOAP namespace and connection URL
strNamespace = "UserService"
strURL = "http://216.161.170.249:5080/openmeetings/services/
UserService/loginUser"
'function you want to call
strFunction = "loginUser"
'strFunction = "test" 'no parameters required
strRequest ="<?xml version=""1.0"" encoding=""utf-8""
standalone=""no""?>" _
& "<SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://
services.axis.openmeetings.org"" xmlns:SOAP-ENC=""http://
schemas.xmlsoap.org/soap/encoding/""" _
& " xmlns:wsdl=""http://schemas.xmlsoap.org/wsdl/""
xmlns:ns2=""http://services.axis.openmeetings.org""" _
& " xmlns:ns1=""http://basic.beans.data.app.openmeetings.org/
xsd"" xmlns:wsaw=""http://www.w3.org/2006/05/addressing/wsdl""" _
& " xmlns:http=""http://schemas.xmlsoap.org/wsdl/http/""
xmlns:ns0=""http://basic.beans.hibernate.app.openmeetings.org/xsd""" _
& " xmlns:xs=""http://www.w3.org/2001/XMLSchema""
xmlns:mime=""http://schemas.xmlsoap.org/wsdl/mime/""
xmlns:soap=""http://schemas.xmlsoap.org/wsdl/soap/""" _
& " xmlns:soap12=""http://schemas.xmlsoap.org/wsdl/soap12/""
xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">" _
& " <SOAP-ENV:Body>" _
& " <ns2:loginUser xmlns:ns2=""http://
services.axis.openmeetings.org"">" _
& " <ns2:SID>"&sid&"</ns2:SID>" _
& " <ns2:username>admin</ns2:username>" _
& " <ns2:userpass>PASSWORD</ns2:userpass>" _
& " </ns2:loginUser>" _
& " </SOAP-ENV:Body>" _
& "</SOAP-ENV:Envelope>"
objXMLHTTP.open "post", "" & strURL & "", False
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strRequest)
'objXMLHTTP.setRequestHeader "SOAPAction", "http://localhost:5080/
openmeetings/services/UserService/loginUser"
'send the request and capture the result
objXMLHTTP.send(strRequest)
strResult = objXMLHTTP.responseText
txt =strResult
if txt <> "1" then
session("errid") = txt
response.write "<p>Login Failed: error = "&txt&"<br>"
call getErrorByCode
else
Response.write "<br><BR>Login sucessful strresponse = " & txt &"<BR>"
end if
'added to get response
If objXMLHTTP.status = 200 Then
If Not objXMLHTTP.responseXML Is Nothing And _
Not objXMLHTTP.responseXML.documentElement Is Nothing And _
objXMLHTTP.responseXML.parseError.errorCode <> 0 Then
Set ResponseXML = objXMLHTTP.responseXML
WellFormed = True
Else
Set ResponseXML = Server.CreateObject("Msxml2.DOMDocument.3.0")
ResponseXML.async = False
WellFormed = ResponseXML.load(objXMLHTTP.responseStream)
End If
If WellFormed Then
Response.Write "<p>Got XML document with " & _
ResponseXML.getElementsByTagName("*").length & _
" elements</p>" & VbCrLf
Dim str2
str2 = ""
Set objNodeList = ResponseXML.getElementsByTagName("*")
For i = 0 To (objNodeList.length - 1)
str2 = objNodeList.Item(i).xml & vbCrLf
response.write i&" = "&str &"<BR>"
Next
Else
Response.Write "<p>Parsing failed: " & _
ResponseXML.parseError.reason & _
"</p>" & VbCrLf
End If
Else
Response.Write "<p>HTTP status: " & _
objXMLHTTP.status & " " & _
objXMLHTTP.statusText & _
"</p>" & VbCrLf
End If
Set objXMLHTTP = nothing
end sub
""This sub is receiving the sid,errorcode -10 and 1 for the language
ID however, openmeetings is throwing nulll pointer exception in the
logs
sub getErrorByCode()
dim sid
dim errid
Dim objXMLHTTP : set objXMLHTTP = Server.CreateObject("Msxml2.XMLHTTP.
3.0")
Dim strRequest, strResult, strFunction, strURL, strNamespace
sid = session("sid")
errid = session("errid")
response.write "sid recieved = "&sid&"<BR>"
response.write "error recieved = "&errid&"<BR>"
'URL to SOAP namespace and connection URL
strNamespace = "UserService"
strURL = "http://216.161.170.249:5080/openmeetings/services/
UserService/getErrorByCode"
'function you want to call
strFunction = "getErrorByCode"
'strFunction = "test" 'no parameters required
strRequest ="<?xml version=""1.0"" encoding=""utf-8""
standalone=""no""?>" _
& "<SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://
services.axis.openmeetings.org"" xmlns:SOAP-ENC=""http://
schemas.xmlsoap.org/soap/encoding/""" _
& " xmlns:wsdl=""http://schemas.xmlsoap.org/wsdl/""
xmlns:ns2=""http://services.axis.openmeetings.org""" _
& " xmlns:ns1=""http://basic.beans.data.app.openmeetings.org/
xsd"" xmlns:wsaw=""http://www.w3.org/2006/05/addressing/wsdl""" _
& " xmlns:http=""http://schemas.xmlsoap.org/wsdl/http/""
xmlns:ns0=""http://basic.beans.hibernate.app.openmeetings.org/xsd""" _
& " xmlns:xs=""http://www.w3.org/2001/XMLSchema""
xmlns:mime=""http://schemas.xmlsoap.org/wsdl/mime/""
xmlns:soap=""http://schemas.xmlsoap.org/wsdl/soap/""" _
& " xmlns:soap12=""http://schemas.xmlsoap.org/wsdl/soap12/""
xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">" _
& " <SOAP-ENV:Body>" _
& " <ns2:getErrorByCode xmlns:ns2=""http://
services.axis.openmeetings.org"">" _
& " <ns2:SID>"&sid&"</ns2:SID>" _
& " <ns2:errorid>&errid&</ns2:errorid>" _
& " <ns2:language_id>1</ns2:language_id>" _
& " </ns2:getErrorByCode>" _
& " </SOAP-ENV:Body>" _
& "</SOAP-ENV:Envelope>"
objXMLHTTP.open "post", "" & strURL & "", False
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strRequest)
'objXMLHTTP.setRequestHeader "SOAPAction", "http://localhost:5080/
openmeetings/services/UserService/getErrorByCode"
'send the request and capture the result
objXMLHTTP.send(strRequest)
strResult = objXMLHTTP.responseText
txt =strResult
Response.write "<br><BR>Login Error = " & txt &"<BR>"
'added to get response
If objXMLHTTP.status = 200 Then
If Not objXMLHTTP.responseXML Is Nothing And _
Not objXMLHTTP.responseXML.documentElement Is Nothing And _
objXMLHTTP.responseXML.parseError.errorCode <> 0 Then
Set ResponseXML = objXMLHTTP.responseXML
WellFormed = True
Else
Set ResponseXML = Server.CreateObject("Msxml2.DOMDocument.3.0")
ResponseXML.async = False
WellFormed = ResponseXML.load(objXMLHTTP.responseStream)
End If
If WellFormed Then
Response.Write "<p>Got XML document with " & _
ResponseXML.getElementsByTagName("*").length & _
" elements</p>" & VbCrLf
Dim str2
str2 = ""
Set objNodeList = ResponseXML.getElementsByTagName("*")
For i = 0 To (objNodeList.length - 1)
str2 = objNodeList.Item(i).xml & vbCrLf
response.write i&" = "&str &"<BR>"
Next
Else
Response.Write "<p>Parsing failed: " & _
ResponseXML.parseError.reason & _
"</p>" & VbCrLf
End If
Else
Response.Write "<p>HTTP status: " & _
objXMLHTTP.status & " " & _
objXMLHTTP.statusText & _
"</p>" & VbCrLf
End If
Set objXMLHTTP = nothing
end sub
%>
Log files Openmeetings:
DEBUG 11-04 12:28:56.843 ContextLoggingListener.java 187 80 ROOT
[main] - Starting up context openmeetings
DEBUG 11-04 12:28:59.046 ScopeApplicationAdapter.java 2390 146
org.openmeetings.app.remote.red5.ScopeApplicationAdapter [Launcher:/
openmeetings] - webAppPath : C:\red5\webapps\openmeetings
DEBUG 11-04 12:28:59.046 ScopeApplicationAdapter.java 2390 147
org.openmeetings.app.remote.red5.ScopeApplicationAdapter [Launcher:/
openmeetings] - batchFileFir : C:\red5\webapps\openmeetings\streams\
DEBUG 11-04 12:29:08.843 EmoticonsManager.java 12187 53
org.openmeetings.app.remote.red5.EmoticonsManager [Launcher:/
openmeetings] - ##### loadEmot completed
DEBUG 11-04 12:29:16.656 MainService.java 20000 179
org.openmeetings.app.remote.MainService [http-0.0.0.0-5080-1] - ::
getsessiondata
DEBUG 11-04 12:29:16.671 Sessionmanagement.java 20015 71
org.openmeetings.app.data.basic.Sessionmanagement
[http-0.0.0.0-5080-1] - startsession :: startsession
DEBUG 11-04 12:29:16.671 ManageCryptStyle.java 20015 26
org.openmeetings.utils.crypt.ManageCryptStyle [http-0.0.0.0-5080-1] -
getInstanceOfCrypt:
org.openmeetings.utils.crypt.managecryptst...@7bb2cb
DEBUG 11-04 12:29:16.671 ManageCryptStyle.java 20015 28
org.openmeetings.utils.crypt.ManageCryptStyle [http-0.0.0.0-5080-1] -
getInstanceOfCrypt:
org.openmeetings.app.data.basic.configurationmanagem...@1172fb9
DEBUG 11-04 12:29:16.671 ManageCryptStyle.java 20015 33
org.openmeetings.utils.crypt.ManageCryptStyle [http-0.0.0.0-5080-1] -
configKeyCryptClassName:
org.openmeetings.utils.crypt.MD5Implementation
DEBUG 11-04 12:29:16.781 UserService.java 20125 50
org.openmeetings.axis.services.UserService [http-0.0.0.0-5080-1] -
UserService.loginuser
DEBUG 11-04 12:29:16.796 Usermanagement.java 20140 229
org.openmeetings.app.data.user.Usermanagement [http-0.0.0.0-5080-1] -
debug SIZE: 0
DEBUG 11-04 12:29:16.796 UserService.java 20140 57
org.openmeetings.axis.services.UserService [http-0.0.0.0-5080-1] -
objName: java.lang.Long
DEBUG 11-04 12:29:16.812 UserService.java 20156 77
org.openmeetings.axis.services.UserService [http-0.0.0.0-5080-1] -
UserService.getErrorbyCode
ERROR 11-04 12:29:16.812 UserService.java 20156 92
org.openmeetings.axis.services.UserService [http-0.0.0.0-5080-1] -
[getErrorByCode]
java.lang.NullPointerException: null
at
org.openmeetings.axis.services.UserService.getErrorByCode(UserService.java:
79) [na:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [na:
1.6.0_12]
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39) [na:1.6.0_12]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25) [na:1.6.0_12]
at java.lang.reflect.Method.invoke(Method.java:597) [na:1.6.0_12]
at
org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:
194) [axis2-adb-1.3.jar:na]
at
org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:
98) [axis2-adb-1.3.jar:na]
at
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:
40) [axis2-kernel-1.3.jar:na]
at
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:
96) [axis2-kernel-1.3.jar:na]
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
[axis2-kernel-1.3.jar:na]
at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:
275) [axis2-kernel-1.3.jar:na]
at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:
120) [axis2-kernel-1.3.jar:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
[javaee-api-5.1.1.jar:5.1.1]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
[javaee-api-5.1.1.jar:5.1.1]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
290) [catalina-6.0.24.jar:na]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206) [catalina-6.0.24.jar:na]
at
org.openmeetings.servlet.outputhandler.ServletRequestExFilter.doFilter(ServletRequestExFilter.java:
35) [openmeetings.jar:na]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235) [catalina-6.0.24.jar:na]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206) [catalina-6.0.24.jar:na]
at
org.red5.logging.LoggerContextFilter.doFilter(LoggerContextFilter.java:
87) [red5.jar:na]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235) [catalina-6.0.24.jar:na]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206) [catalina-6.0.24.jar:na]
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
233) [catalina-6.0.24.jar:na]
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
191) [catalina-6.0.24.jar:na]
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:
465) [catalina-6.0.24.jar:na]
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127) [catalina-6.0.24.jar:na]
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
102) [catalina-6.0.24.jar:na]
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
555) [catalina-6.0.24.jar:na]
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109) [catalina-6.0.24.jar:na]
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
298) [catalina-6.0.24.jar:na]
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
852) [tomcat-coyote-6.0.24.jar:na]
at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Http11Protocol.java:588) [tomcat-
coyote-6.0.24.jar:na]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:
489) [tomcat-coyote-6.0.24.jar:na]
at java.lang.Thread.run(Thread.java:619) [na:1.6.0_12]
Openmeeting access log:
216.161.170.250 - - [04/Nov/2010:12:29:16 -0700] "POST /openmeetings/
services/UserService/getSession HTTP/1.0" 200 995
216.161.170.250 - - [04/Nov/2010:12:29:16 -0700] "POST /openmeetings/
services/UserService/loginUser HTTP/1.0" 200 120
216.161.170.250 - - [04/Nov/2010:12:29:16 -0700] "POST /openmeetings/
services/UserService/getErrorByCode HTTP/1.0" 200 186
Where would I look to find out what is causing the null pointer and
why it does not recognize the username?
Miles
--
You received this message because you are subscribed to the Google Groups
"OpenMeetings User" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/openmeetings-user?hl=en.