• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

SOAP authentication configured in app-context.xml

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am trying to configure a SOAP client to connect and authenticate to a WS. This uses http basic authentication. The client is a Maven-Spring-Axis2 project.
My Java code is:

My app-context.xml causes errors:

The xml editor shows errors for the <http>, <authentication-manager>, <context:component-scan> tags. Obviously, the namespace is incorrect. I copied the <beans> starting element and the above mentioned elements from here:
http://static.springsource.org/spring-security/site/docs/3.1.x/reference/ns-config.html
and i also tried several Google hits from the net. None of them worked. My actual app-context.xml is:

My original app-context.xml was OK, but when i added the security related tags, it caused the same problem. Without them i got of course a 401 - Unauthorized error. Not xml related error.

Could anyone please answer with a valid app-context.xml (whatever it's name is) with http basic authentication?
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Zoltan,

Please download spring-seciruty-3.0.xsd,spring-beans-3.0.xsd from the following location http://www.springframework.org/schema/security/spring-security-3.0.xsd , http://www.springframework.org/schema/beans/spring-beans-3.0.xsd respectively and copy it to the same location where your app-context.xml resides.

After that modify the app-context.xml to look like below



Please try the above and let me know you observations on initial step and then we can proceed with http authentication.

Thanks,
Keasva

 
Zoltaan Szabo
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you.
I made the changes but i got an error:


15:24:11,498 WARN eans.factory.xml.XmlBeanDefinitionReader: 47 - Ignored XML validation warning
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'spring-security-3.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
...
Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 7 in XML document from class path resource [META-INF/spring/app-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'security:http'.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand this issue. Please replace "http://www.springframework.org/schema/beans/spring-beans-3.0.xsd" to the location where you kept your spring-beans-3.0.xsd files. The location should start from WEB-INF. In the similar way also change the spring-security-3.0.xsd to the location where you kept your spring-security-3.0.xsd files



Ideally it should look like this.



/WEB-INF/ is the place where you need to keep your app-context.xml.

Please try this and let me know the results.

Thanks,
Kesava
 
Zoltaan Szabo
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried first to put spring-beans-3.0.xsd and spring-security-3.0.xsd to the same location where my app-context.xml resides. Then according to your reply i created a WEB-INF folder under the root of the project.
I still get an error:

This is not a Web project. I created it from the template Sprig utility project. I am not sure if the WEB-INF folder should be under the root of the project, or under some other folder?
 
Zoltaan Szabo
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
now my app-config.xml is:

and the error message is:

 
Zoltaan Szabo
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My app-config.xml is as foolows, and causes no more parsing errors:


Now i get a org.apache.cxf.transport.http.HTTPException: HTTP response '401: Unauthorized' error. The http basic auth is configured in the servers web.xml:

In tomcat-users.xml the user is added:


I can open the wsdl in the browser giving username/password.
What can cause this 401: Unauthorized error for the client?
reply
    Bookmark Topic Watch Topic
  • New Topic