aletz
11-23-2007, 01:25 AM
Hi Bruno,
The sample works fine, but when i try to consume the service the browser throws the follow message:
System.ApplicationException: Only SOAP request are permitted
so, i wrote an asp like this:
<%
Dim o_XmlhttpCaller
Set o_XmlhttpCaller = Server.CreateObject("Msxml2.XMLHTTP")
If ( o_XmlhttpCaller is nothing ) Then
Response.Write("<font color=red size=-1>Unable to create Object - Type: Msxml2.XMLHTTP<BR></font>")
Response.Write("Solution: Install MSXML 4.0")
End If
o_XmlhttpCaller.open "POST","http://gucoba_server/Calculator.Web/calculatorServiceWse.asmx", False
o_XmlhttpCaller.setRequestHeader "Content-Type", "text/xml"
o_XmlhttpCaller.setRequestHeader "SOAPAction","http://SpringCalculator/WebServices/Add"
Dim soapMessage
soapMessage = "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
soapMessage = soapMessage & "<soap:Header>"
soapMessage = soapMessage & "<wsse:Security soap:mustUnderstand=""1"">"
soapMessage = soapMessage & "<wsse:UsernameToken namespaces>"
soapMessage = soapMessage & "<wsse:Username>bbaia</wsse:Username>"
soapMessage = soapMessage & "<wsse:Password Type=""type info"">bbaia</wsse:Password>"
soapMessage = soapMessage & "</wsse:UsernameToken>"
soapMessage = soapMessage & "<wsse:Security>"
soapMessage = soapMessage & "</soap:Header>"
soapMessage = soapMessage & "<soap:Body>"
soapMessage = soapMessage & "<Add xmlns=""http://SpringCalculator/WebServices"">"
soapMessage = soapMessage & "<n1>1</n1>"
soapMessage = soapMessage & "<n2>1</n2>"
soapMessage = soapMessage & "</Add>"
soapMessage = soapMessage & "</soap:Body>"
soapMessage = soapMessage & "</soap:Envelope>"
o_XmlhttpCaller.send(soapMessage)
Response.Write(o_XmlhttpCaller.responseText)
Set o_XmlhttpCaller = nothing
%>
And when i called the asp, the server sends me a error message:
http://schemas.xmlsoap.org/ws/2004/03/addressing/faultuuid:74666e69-166b-49f3-aaf3-c9db41562087http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymoussoap:ServerSystem.Web.Services.Protocols. SoapHeaderException: Server unavailable, please try later ---> System.Configuration.ConfigurationException: WSE032: There was an error loading the microsoft.web.services2 configuration section. ---> System.Configuration.ConfigurationErrorsException: WSE040: Type WebServerApp.MyUsernameTokenManager, WebServerApp could not be loaded. Please check the configuration file. en System.Configuration.BaseConfigurationRecord.Evalu ateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult) en System.Configuration.BaseConfigurationRecord.Evalu ate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) en System.Configuration.BaseConfigurationRecord.GetSe ctionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) en System.Configuration.BaseConfigurationRecord.GetSe ction(String configKey, Boolean getLkg, Boolean checkPermission) en System.Configuration.BaseConfigurationRecord.GetSe ction(String configKey) en System.Web.Configuration.HttpConfigurationSystem.S ystem.Configuration.Internal.IInternalConfigSystem .GetSection(String configKey) en System.Configuration.ConfigurationManager.GetSecti on(String sectionName) en System.Configuration.ConfigurationSettings.GetConf ig(String sectionName) en Microsoft.Web.Services2.Configuration.WebServicesC onfiguration.Initialize() --- Fin del seguimiento de la pila de la excepci�n interna --- en Microsoft.Web.Services2.Configuration.WebServicesC onfiguration.Initialize() en Microsoft.Web.Services2.WebServicesExtension.Befor eDeserializeServer(SoapServerMessage message) --- Fin del seguimiento de la pila de la excepci�n interna ---http://gucoba_server/Calculator.Web/calculatorServiceWse.asmx
so, i changed the web.config to....
<security>
<securityTokenManager type="WebServerApp.MyUsernameTokenManager, WebServerApp" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
qname="wsse:UsernameToken" />
</security>
and finally the server sends me the next message...
http://schemas.xmlsoap.org/ws/2004/03/addressing/faultuuid:fa5c1988-171b-4781-8ca5-09c3a0742701http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymoussoap:ServerSystem.Web.Services.Protocols. SoapHeaderException: Server unavailable, please try later ---> System.Configuration.ConfigurationException: WSE032: There was an error loading the microsoft.web.services2 configuration section. ---> System.Configuration.ConfigurationErrorsException: WSE041: Type Calculator.Web.MyUsernameTokenManager does not implement Microsoft.Web.Services2.Security.Tokens.ISecurityT okenManager. en System.Configuration.BaseConfigurationRecord.Evalu ateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult) en System.Configuration.BaseConfigurationRecord.Evalu ate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) en System.Configuration.BaseConfigurationRecord.GetSe ctionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) en System.Configuration.BaseConfigurationRecord.GetSe ction(String configKey, Boolean getLkg, Boolean checkPermission) en System.Configuration.BaseConfigurationRecord.GetSe ction(String configKey) en System.Web.Configuration.HttpConfigurationSystem.S ystem.Configuration.Internal.IInternalConfigSystem .GetSection(String configKey) en System.Configuration.ConfigurationManager.GetSecti on(String sectionName) en System.Configuration.ConfigurationSettings.GetConf ig(String sectionName) en Microsoft.Web.Services2.Configuration.WebServicesC onfiguration.Initialize() --- Fin del seguimiento de la pila de la excepci�n interna --- en Microsoft.Web.Services2.Configuration.WebServicesC onfiguration.Initialize() en Microsoft.Web.Services2.WebServicesExtension.Befor eDeserializeServer(SoapServerMessage message) --- Fin del seguimiento de la pila de la excepci�n interna ---http://gucoba_server/Calculator.Web/calculatorServiceWse.asmx
so, i hope that you can help me and undertand what is the problem... if my asp is bad. Iam running your demo in windows server 2003 and WSE 2.0.
in the other hand, i upgraded WSE 2.0 SP2 to SP3 and now, i have tried with a app client instead asp...the code is follow...
using System;
using ConsoleApplicationESBClient.gucoba_server;
using ConsoleApplicationESBClient.gucoba_server_Wse;
namespace ConsoleApplicationESBClient
{
class Program
{
static void Main(string[] args)
{
gucoba_server.calculatorService cs = new gucoba_server.calculatorService();
Console.WriteLine(cs.Add(2, 3));
Console.ReadLine();
gucoba_server_Wse.calculatorServiceWse cswse = new gucoba_server_Wse.calculatorServiceWse();
Console.WriteLine(cswse.Add(5, 8));
Console.ReadLine();
}
}
}
In the fiest service (without WSE) the app prints "5", but the service(WSE) prin the follow error:
The message must contain a wsa:To header
Can someone help me??
Thank you in advance.
Regards, Aletz
Hi,
I've updated the sample in the forum question page (http://opensource.atlassian.com/confluence/spring/display/NET/Forum+Questions).
Give it a try, and let me know.
In the sample I used the ASP.NET development server that comes with VS2005, but it should work in IIS too.
What you need is that your service name ends in .rem or .soap.
You can test the remote object accessing its metadata :
http://localhost:1444/RemotingWeb/RemotedCounter.rem?wsdl
Hoper this helps,
Bruno
The sample works fine, but when i try to consume the service the browser throws the follow message:
System.ApplicationException: Only SOAP request are permitted
so, i wrote an asp like this:
<%
Dim o_XmlhttpCaller
Set o_XmlhttpCaller = Server.CreateObject("Msxml2.XMLHTTP")
If ( o_XmlhttpCaller is nothing ) Then
Response.Write("<font color=red size=-1>Unable to create Object - Type: Msxml2.XMLHTTP<BR></font>")
Response.Write("Solution: Install MSXML 4.0")
End If
o_XmlhttpCaller.open "POST","http://gucoba_server/Calculator.Web/calculatorServiceWse.asmx", False
o_XmlhttpCaller.setRequestHeader "Content-Type", "text/xml"
o_XmlhttpCaller.setRequestHeader "SOAPAction","http://SpringCalculator/WebServices/Add"
Dim soapMessage
soapMessage = "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
soapMessage = soapMessage & "<soap:Header>"
soapMessage = soapMessage & "<wsse:Security soap:mustUnderstand=""1"">"
soapMessage = soapMessage & "<wsse:UsernameToken namespaces>"
soapMessage = soapMessage & "<wsse:Username>bbaia</wsse:Username>"
soapMessage = soapMessage & "<wsse:Password Type=""type info"">bbaia</wsse:Password>"
soapMessage = soapMessage & "</wsse:UsernameToken>"
soapMessage = soapMessage & "<wsse:Security>"
soapMessage = soapMessage & "</soap:Header>"
soapMessage = soapMessage & "<soap:Body>"
soapMessage = soapMessage & "<Add xmlns=""http://SpringCalculator/WebServices"">"
soapMessage = soapMessage & "<n1>1</n1>"
soapMessage = soapMessage & "<n2>1</n2>"
soapMessage = soapMessage & "</Add>"
soapMessage = soapMessage & "</soap:Body>"
soapMessage = soapMessage & "</soap:Envelope>"
o_XmlhttpCaller.send(soapMessage)
Response.Write(o_XmlhttpCaller.responseText)
Set o_XmlhttpCaller = nothing
%>
And when i called the asp, the server sends me a error message:
http://schemas.xmlsoap.org/ws/2004/03/addressing/faultuuid:74666e69-166b-49f3-aaf3-c9db41562087http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymoussoap:ServerSystem.Web.Services.Protocols. SoapHeaderException: Server unavailable, please try later ---> System.Configuration.ConfigurationException: WSE032: There was an error loading the microsoft.web.services2 configuration section. ---> System.Configuration.ConfigurationErrorsException: WSE040: Type WebServerApp.MyUsernameTokenManager, WebServerApp could not be loaded. Please check the configuration file. en System.Configuration.BaseConfigurationRecord.Evalu ateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult) en System.Configuration.BaseConfigurationRecord.Evalu ate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) en System.Configuration.BaseConfigurationRecord.GetSe ctionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) en System.Configuration.BaseConfigurationRecord.GetSe ction(String configKey, Boolean getLkg, Boolean checkPermission) en System.Configuration.BaseConfigurationRecord.GetSe ction(String configKey) en System.Web.Configuration.HttpConfigurationSystem.S ystem.Configuration.Internal.IInternalConfigSystem .GetSection(String configKey) en System.Configuration.ConfigurationManager.GetSecti on(String sectionName) en System.Configuration.ConfigurationSettings.GetConf ig(String sectionName) en Microsoft.Web.Services2.Configuration.WebServicesC onfiguration.Initialize() --- Fin del seguimiento de la pila de la excepci�n interna --- en Microsoft.Web.Services2.Configuration.WebServicesC onfiguration.Initialize() en Microsoft.Web.Services2.WebServicesExtension.Befor eDeserializeServer(SoapServerMessage message) --- Fin del seguimiento de la pila de la excepci�n interna ---http://gucoba_server/Calculator.Web/calculatorServiceWse.asmx
so, i changed the web.config to....
<security>
<securityTokenManager type="WebServerApp.MyUsernameTokenManager, WebServerApp" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
qname="wsse:UsernameToken" />
</security>
and finally the server sends me the next message...
http://schemas.xmlsoap.org/ws/2004/03/addressing/faultuuid:fa5c1988-171b-4781-8ca5-09c3a0742701http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymoussoap:ServerSystem.Web.Services.Protocols. SoapHeaderException: Server unavailable, please try later ---> System.Configuration.ConfigurationException: WSE032: There was an error loading the microsoft.web.services2 configuration section. ---> System.Configuration.ConfigurationErrorsException: WSE041: Type Calculator.Web.MyUsernameTokenManager does not implement Microsoft.Web.Services2.Security.Tokens.ISecurityT okenManager. en System.Configuration.BaseConfigurationRecord.Evalu ateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult) en System.Configuration.BaseConfigurationRecord.Evalu ate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) en System.Configuration.BaseConfigurationRecord.GetSe ctionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) en System.Configuration.BaseConfigurationRecord.GetSe ction(String configKey, Boolean getLkg, Boolean checkPermission) en System.Configuration.BaseConfigurationRecord.GetSe ction(String configKey) en System.Web.Configuration.HttpConfigurationSystem.S ystem.Configuration.Internal.IInternalConfigSystem .GetSection(String configKey) en System.Configuration.ConfigurationManager.GetSecti on(String sectionName) en System.Configuration.ConfigurationSettings.GetConf ig(String sectionName) en Microsoft.Web.Services2.Configuration.WebServicesC onfiguration.Initialize() --- Fin del seguimiento de la pila de la excepci�n interna --- en Microsoft.Web.Services2.Configuration.WebServicesC onfiguration.Initialize() en Microsoft.Web.Services2.WebServicesExtension.Befor eDeserializeServer(SoapServerMessage message) --- Fin del seguimiento de la pila de la excepci�n interna ---http://gucoba_server/Calculator.Web/calculatorServiceWse.asmx
so, i hope that you can help me and undertand what is the problem... if my asp is bad. Iam running your demo in windows server 2003 and WSE 2.0.
in the other hand, i upgraded WSE 2.0 SP2 to SP3 and now, i have tried with a app client instead asp...the code is follow...
using System;
using ConsoleApplicationESBClient.gucoba_server;
using ConsoleApplicationESBClient.gucoba_server_Wse;
namespace ConsoleApplicationESBClient
{
class Program
{
static void Main(string[] args)
{
gucoba_server.calculatorService cs = new gucoba_server.calculatorService();
Console.WriteLine(cs.Add(2, 3));
Console.ReadLine();
gucoba_server_Wse.calculatorServiceWse cswse = new gucoba_server_Wse.calculatorServiceWse();
Console.WriteLine(cswse.Add(5, 8));
Console.ReadLine();
}
}
}
In the fiest service (without WSE) the app prints "5", but the service(WSE) prin the follow error:
The message must contain a wsa:To header
Can someone help me??
Thank you in advance.
Regards, Aletz
Hi,
I've updated the sample in the forum question page (http://opensource.atlassian.com/confluence/spring/display/NET/Forum+Questions).
Give it a try, and let me know.
In the sample I used the ASP.NET development server that comes with VS2005, but it should work in IIS too.
What you need is that your service name ends in .rem or .soap.
You can test the remote object accessing its metadata :
http://localhost:1444/RemotingWeb/RemotedCounter.rem?wsdl
Hoper this helps,
Bruno