SvcUtil creates incorrect namespace in the proxy

I create the WCF proxy with the cmd:
svcutil.exe /wrapped /serializer:XmlSerializer GenericTicketConnector.wsdl /o:OTRS.cs /config:App.Config /n:*,OTRSClient.OTRSServiceReference
Contract GenericTicketConnector.wsdl you can see here:
https://raw.githubusercontent.com/OTRS/otrs/rel-3_3/development/webservices/GenericTicketConnector.wsdl
My WCF client code:
using (OTRSClient.OTRSServiceReference.GenericTicketConnector_InterfaceClient tst = new OTRSClient.OTRSServiceReference.GenericTicketConnector_InterfaceClient("GenericTicketConnector_endPoint"))
OTRSClient.OTRSServiceReference.OTRS_SessionCreate sc = new OTRSClient.OTRSServiceReference.OTRS_SessionCreate();
sc.ItemElementName = OTRSClient.OTRSServiceReference.ItemChoiceType8.UserLogin;
sc.Item = "soap";
sc.Password = "1234567";
OTRSClient.OTRSServiceReference.OTRS_SessionCreateResponse res = tst.SessionCreate(sc);
File.WriteAllText("SessionID.txt", res.SessionID);
SvcUtil created this proxy:
[System.ServiceModel.MessageBodyMemberAttribute(Name="SessionCreateResponse", Namespace="", Order=0)]
public OTRSClient.OTRSServiceReference.OTRS_SessionCreateResponse SessionCreateResponse1;
But response from server looks like this:
<soap:Envelope soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding" xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<s:Header xmlns:s="http://www.w3.org/2003/05/soap-envelope"></s:Header>
<soap:Body>
<SessionCreateResponse xmlns="http://www.otrs.org/TicketConnector/">
<SessionID>r3oRuOPBXiYtOZCCKIL5ZNSCDCKS7lAt</SessionID>
</SessionCreateResponse>
</soap:Body>
</soap:Envelope>
Response in my WCF client's code was null.
I manually corrected the proxy like this:
[System.ServiceModel.MessageBodyMemberAttribute(Name="SessionCreateResponse", Namespace="http://www.otrs.org/TicketConnector/", Order=0)]
public OTRSClient.OTRSServiceReference.OTRS_SessionCreateResponse SessionCreateResponse1;
And the answer began to contain the required data (response is not null).
How to fix the parameters of the command line SvcUtil call? Or I must fix the WSDL file?
I need to make a proxy automatically with the correct namespace.

Hi Andrey Antipov,
Based on your description, it seems that you are using the XmlSerializer, please try to use the
DataContractSerializer to see if it can work.
Besides, please also try to use the "Add Servicexs Reference"  to see if it can make a proxy automatically with the correct namespace.
Best Regards,
Amy Peng
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Errro while creating the proxy

    Hi Gurus,
    Im currently working on file to proxy scenario.
    I am using file adapter to pick up the xml file and send to the sap ECC system using proxy.
    1)I used the external definition to create the outbound message type and inbound message type is the same.
    One to One mapping is created. File adapter is picking the xm file and sending to IE. Mapping is taking place and the message is sent to SAP ECC system using XI adapter.
    I created inbound proxy for the inbound messge interface.Then exception is occured in library handler.
    Incorrect value:Schema without target namespace must not contain any subelements, except xsd:import/xsd:include/xsd:annotation.
    This is occured in the wsdl section.
    Can you please help avoiding this error in proxy generation if I use the above method 1.
    2)To avoid this ,I created the data type and message type.
    But Im gettign mapping exception in PI because when I create the message in PI, it is expectiong the xml file to include the namespace ns0:MT_messagetype xmlns:ns0="http://...." but the xml file placed in the FTP server does not contain the namespace.
    Im able to create the proxy if I use this message type but this is throwing mapping error due to different file format expected by PI.
    If I use the method 2, how can avoid the mapping error.
    Any help appreciated.
    Thanks,
    Jay

    You might get better results in the PI forum

  • Error while creating the proxy object to connect to a third party tool.

    Hi,
    I tried creating a proxy object with the wsdl file. I even created a HTTP connection to the third party tool. but when I try to execute the whole proxy object, I am getting the below error. Can anyone help me on this?
    "Proxy-Generierung: Fehler aufgetreten"
    "Incorrect value: Entity "<<document>>"(92 /3788 ). end tag 'ul' does not match begin tag 'p'"
    Thanks & Regards,
    Veerabhadra Rao A.

    do a check on the wsdl file and how you are passing values in the proxy. The tags for XML are not correct. Open the WSDL in IE and see there must be an error. Or probably when passing the actual values to the XML generated each element is not closed properly. Error says tags dont match.
    Edited by: Kshamatha Eda on Mar 5, 2010 10:54 AM

  • Change in the namespace of the Client proxy?

    Hi All,
       I want to know if there is way to change the name space in an existing client proxy. The problem is the provider system is not fully set up yet. So the provider keeps changing the URL to the web services. What is the best way to handle such a situation ?
    Do I need to re-create the proxy each time the namespace is changed or just the regeneration of the proxy is enough? In either case I believe WSDL file should be updated. Please guide me...
    Regards,
    Vamsi
    Edited by: varaprasad bhagavatula on Apr 20, 2010 7:03 PM

    changing URL of endpoint(webservice) won't affect your proxy but changing namespace will affect (there is difference between namespace and endpoint url),
    1. If URL is changing then there is no need to create proxy again but change configuration part in SOAMANAGER.
    2. If namespace is changed then you need to create proxy again.
    Regards,
    Gourav

  • Creating the proxy service

    When I create the proxy service and choose to be created from the WSDL, I have two options for selecting the port and binding, could you explain the difference in choosing between the port or binding?
    Thanks!

    Hi,
    Here is the difference.
    If the service is based on a binding:
    If the service is generated from binding Y in the WSDL resource, the effective WSDL defines a new service and port (<bindingname>QSService and <bindingname>QSPort). None of the ports defined in the WSDL resource are included in the effective WSDL.
    There may be multiple ports in that WSDL associated with that binding. Each port can use a different URL. Therefore, the effective WSDL uses the binding but generates an artificial port from the configuration on the service for that binding. All other ports will be removed.
    If the service is based on a port:
    If the service is generated from port X in the WSDL resource, then port X is also defined in the effective WSDL. Any other ports defined in the WSDL resource are not included. Furthermore, if you base the proxy service on a WSDL port, the effective WSDL uses that port name. The binding is determined from the port, and in turn, the port type is determined from the binding.
    The effective WSDL preserves any WS-Policies associated with the port defined in the resource WSDL.
    The transport address specified in the port definition in the resource WSDL is never used as the address for a proxy service in the effective WSDL:For HTTP services, you must specify a transport address when configuring the transport in the Administration Console or the plug-in. That address is used in the port definition in the effective WSDL.The URL specified as the transport address for a proxy service is always relative to a path in an Oracle Service Bus domain, because Oracle Service Bus always hosts proxy services.
    For SOAP-protocol-based WSDL services, the transport URI in the SOAP binding depends on the transport implementation. For standard transports (like HTTP and JMS), this value is as per the SOAP specification or another universally accepted value. For transports for which SOAP does not define a standard value, Oracle Service Bus sets one consisting of a predefined namespace with the transport ID appended at the end: http://www.oracle.com/transport/2007/05/.
    There is one service element in the effective WSDL, and the port address contains a URL whose syntax and semantic is defined by the transport selected in the binding.
    thanks,
    Richa

  • WSDL Metadata not available to create the proxy, either Service instance or ServiceEndpointInterface com.microsoft.bingads.campaignmanagement.ICampaignManagementService should have WSDL information

    package com;
    import java.rmi.*;
    import com.microsoft.bingads.*;
    import com.microsoft.bingads.campaignmanagement.*;
    public class AdExtensions   {
        static AuthorizationData authorizationData;
        static ServiceClient<ICampaignManagementService> CampaignService;
        private static java.lang.String UserName = "chandan-ai";
        private static java.lang.String Password = "Algo1234";
        private static java.lang.String DeveloperToken = "BBD37VB98";
        private static long CustomerId = 9548596;
        private static long AccountId = 38360461;
        public static void main(java.lang.String[] args) {
            try
                authorizationData = new AuthorizationData();
                authorizationData.setDeveloperToken(DeveloperToken);
                authorizationData.setAuthentication(new PasswordAuthentication(UserName, Password));
                authorizationData.setCustomerId(CustomerId);
                authorizationData.setAccountId(AccountId);
            //      String namespace ="https://bingads.microsoft.com/CampaignManagement/v9";
                //  String url ="https://api.sandbox.bingads.microsoft.com/Api/Advertiser/CampaignManagement/v9/CampaignManagementService.svc?wsdl";
           CampaignService = new ServiceClient<ICampaignManagementService>(
                             authorizationData,ApiEnvironment.SANDBOX,
                             ICampaignManagementService.class);
                 ArrayOfCampaign campaigns = new ArrayOfCampaign();
                 Campaign campaign = new Campaign();
                 campaign.setName("Winter Clothing " + System.currentTimeMillis());
                 campaign.setDescription("Winter clothing line.");
                 campaign.setBudgetType(BudgetLimitType.MONTHLY_BUDGET_SPEND_UNTIL_DEPLETED);
                 campaign.setMonthlyBudget(1000.00);
                 campaign.setTimeZone("PacificTimeUSCanadaTijuana");
                 campaign.setDaylightSaving(true);
                 campaign.setDailyBudget(52.00);
                 campaigns.getCampaigns().add(campaign);
              ArrayOflong campaignIds = addCampaigns(AccountId, campaigns);
              printCampaignIdentifiers(campaignIds);
             } catch (Exception ex) {
                 // Ignore fault exceptions that we already caught.
                 if ( ex.getCause() instanceof AdApiFaultDetail_Exception ||
                      ex.getCause() instanceof EditorialApiFaultDetail_Exception ||
                      ex.getCause() instanceof ApiFaultDetail_Exception )
                 else
                     System.out.println("Error encountered: ");
                     System.out.println(ex.getMessage());
                     ex.printStackTrace();
         // Adds one or more campaigns to the specified account.
         static ArrayOflong addCampaigns(long accountId, ArrayOfCampaign campaigns) throws RemoteException, Exception
             AddCampaignsRequest request = new AddCampaignsRequest();
             // Set the request information.
             request.setAccountId(accountId);
             request.setCampaigns(campaigns);
             System.out.println(request.getCampaigns() + "\n"+ request.getAccountId());
             return CampaignService.getService().addCampaigns(request).getCampaignIds();
         // Prints the campaign identifiers for each campaign added.
         static void printCampaignIdentifiers(ArrayOflong campaignIds)
             if (campaignIds == null)
                 return;
             for (long id : campaignIds.getLongs())
                 System.out.printf("Campaign successfully added and assigned CampaignId %d\n\n", id);
    when running this program i am getting error
     WSDL Metadata not available to create the proxy, either Service instance or ServiceEndpointInterface com.microsoft.bingads.campaignmanagement.ICampaignManagementService should have WSDL information
    javax.xml.ws.WebServiceException: WSDL Metadata not available to create the proxy, either Service instance or ServiceEndpointInterface com.microsoft.bingads.campaignmanagement.ICampaignManagementService should have WSDL information
        at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
        at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
        at javax.xml.ws.Service.getPort(Unknown Source)
        at com.microsoft.bingads.internal.ServiceFactoryImpl.createProxyFromService(ServiceFactoryImpl.java:117)
        at com.microsoft.bingads.ServiceClient.getService(ServiceClient.java:94)
        at com.AdExtensions.addCampaigns(AdExtensions.java:91)
        at com.AdExtensions.main(AdExtensions.java:49)
                                          

    Hello.
    Please make sure you have the correct dependency versions e.g. cxf-rt-frontend-jaxws version 3.0.2. You can find a list of all dependencies for the Bing Ads Java
    SDK here:http://mvnrepository.com/artifact/com.microsoft.bingads/microsoft.bingads/9.3.2-beta
    If you create a Maven project e.g. in Eclipse, the dependencies are included automatically. 
    I hope this helps!

  • Getting Error while creating the proxy generator in Dot Net Connector 2003

    Hi,
    While creating the proxy generator in Dot Net Connector 2003 i am getting following error: I am successfully able to login into the SAP system and able to select the SAP tables but during the final step of proxy generator wizard i am getting following error:
    <b>----
    Error in Proxy-Generator
    To create a proxy directly from a SAP system, you must install a Java VM from JavaSoft
    Inner error was:
    Object reference not set to an instance of an object.
    OK  
    </b>
    I have already installed the Java JVM on my machine its version is as follows:
    <b>java version "1.3.1_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
    Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)</b>
    Regards,
    Ravi Shah

    Hi Amit,
    I doing good!!!! Thanks for the response.
    I uninstalled the earlier version of JVM and installed the latest version of JVM i.e. jre-1_5_0_09-windows-i586-p.
    I got the proper entries under registry mentioned below:
    <b>Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft]
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Plug-in]
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Plug-in\1.5.0_09]
    "JavaHome"="C:
    Program Files
    Java
    jre1.5.0_09"
    "UseJava2IExplorer"=dword:00000001
    "HideSystemTrayIcon"=dword:00000000
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment]
    "CurrentVersion"="1.5"
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.5]
    "JavaHome"="C:
    Program Files
    Java
    jre1.5.0_09"
    "RuntimeLib"="C:
    Program Files
    Java
    jre1.5.0_09
    bin
    client
    jvm.dll"
    "MicroVersion"="0"
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.5.0_09]
    "JavaHome"="C:
    Program Files
    Java
    jre1.5.0_09"
    "MicroVersion"="0"
    "RuntimeLib"="C:
    Program Files
    Java
    jre1.5.0_09
    bin
    client
    jvm.dll"
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Update]
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Update\Policy]
    "Country"="IN"
    "PostStatusUrl"="https://sjremetrics.java.com/b/ss//6"
    "EnableJavaUpdate"=dword:00000001
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Web Start]
    "CurrentVersion"="1.5.0_09"
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Web Start\1.0.1]
    "Home"="C:
    Program Files
    Java
    jre1.5.0_09
    bin"
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Web Start\1.0.1_02]
    "Home"="C:
    Program Files
    Java
    jre1.5.0_09
    bin"
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Web Start\1.0.1_03]
    "Home"="C:
    Program Files
    Java
    jre1.5.0_09
    bin"
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Web Start\1.0.1_04]
    "Home"="C:
    Program Files
    Java
    jre1.5.0_09
    bin"
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Web Start\1.0.1_05]
    "Home"="C:
    Program Files
    Java Web Start"
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Web Start\1.2]
    "Home"="C:
    Program Files
    Java
    jre1.5.0_09
    bin"
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Web Start\1.2.0_01]
    "Home"="C:
    Program Files
    Java
    jre1.5.0_09
    bin"
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Web Start\1.2.0_02]
    "Home"="C:
    Program Files
    Java Web Start"
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Web Start\1.5.0_09]
    "Home"="C:
    Program Files
    Java
    jre1.5.0_09
    bin"</b>
    After installation I opened the Dot Net connector proxy client wizard . I followed the series of step during Dot Net connector configuration:
    1. selected the SAP connector.
    2. The next screen 'Enter Logon Information' comes where i entered the following information System as 'custom', host='IP address', Id='00' but by default it turns to '0' , client='800', user='user id' and password ='password'.
    3. After clicking on Next button i am successfully logon into the SAP system.
    4. The next screen in the wizard is 'selectall the remote function modules that you want to be part of your proxy object'. After selecting the SAP tables and clicked on Next button I am getting following error
    <b>
    Error in Proxy-Generator
    To create a proxy directly from a SAP system, you must install a Java VM from JavaSoft
    Inner error was:
    INFO: using logging implementation "AII Logging"
    Exception in thread "main" com.sap.aii.upload.api.LoginException$WrongPassword: Invalid user/password combination
         at com.sap.aii.upload.sap.SAPConnection.connect(SAPConnection.java:94)
         at com.sap.aii.upload.sap.SAPConnection.<init>(SAPConnection.java:38)
         at com.sap.aii.upload.tool.RFC2WSDLTool.getWSDLforRFCs(RFC2WSDLTool.java:81)
         at com.sap.aii.upload.tool.RFC2WSDLTool.main(RFC2WSDLTool.java:196)
    OK  
    </b>
    Thanks and Regards,
    Ravi Shah

  • Why won't the proxy settings be created in the keychain access?

    Hello,
    I'm having an issue with an iMac that won't keep the proxy settings saved. My company has proxy settings active to use the internet and for some reason they will not stick. I noticed that the keychain access is not creating this internet password and I also noticed it's only happening for a certain user only. In the administrator profile, the keychain is working perfectly fine so I narrow it down to the profile issue. Any suggestions?
    Thanks,

    Network settings apply to all users on the system. Administrator privileges are required to change them.

  • Error by the proxy

    Hi Gurus,
                      I am facing one problem related to proxy.Our scenario is Data is flowing from mainframe system in to XI through custom adapter build by us and then through inbound proxy data is getting posted in to the SAP ISU system and the order is getting created .Since the scenario is synchronous then the response message is coming out of SAP with the details of the order and going into the mainframe system through XI.Now sometimes it is giving a error in XI as follows:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Inbound Message
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIProxy</SAP:Category>
      <SAP:Code area="ABAP">DYNAMIC_CALL_FAILURE</SAP:Code>
      <SAP:P1>DYNPRO_SEND_IN_BACKGROUND</SAP:P1>
      <SAP:P2>ZCL_MIIS_AP2_5_1_13_UMFA</SAP:P2>
      <SAP:P3>EXECUTE_SYNCHRONOUS</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>Error during proxy processing Sending of dynpro SAPLSMPO 0100 not possible: No window system type specified</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Please let me know if any one had faced this problem and it's solution.

    Hi Stefan,
                    In the proxy program atfirst there is some validation check being done on data and then notification and order is created using BAPI  'BAPI_ALM_NOTIF_SAVE' and then 'BAPI_TRANSACTION_COMMIT' to save the notification.Then 'BAPI_ALM_ORDER_MAINTAIN ' is used to save and release the order. Is the coding creating the problem ?
    Thanks and Regards,
    Arijit Guha.

  • Missing Namespace with the SOAP msg sent by C#

    Hi All,
    The wsdl file is generated by SAP XI. I used the XMLSpy to test it and get successful response.
    Then I used wsdl.exe of .net 2.0 sdk to generate the C# proxy class, and use csc.exe to compile it to a dll, and then refer it in the project. After sent the soap message by C#, the XI shows the message is wrong, then I compare this soap envelop body with the one I sent by the XMLSpy as follow:
    C#:
    <MT_PP_014_PrdOrderGoodsRcv xmlns="http://mycompany.com/xi/sap/system/pp">
    <content>
    </content>
    </MT_PP_014_PrdOrderGoodsRcv>
    XMLSPY:
    <m:MT_PP_014_PrdOrderGoodsRcv xmlns:m="http://mycompany.com/xi/sap/system/pp">
    <content>
    </content>
    </m:MT_PP_014_PrdOrderGoodsRcv>
    so it is the namespace, according the xml generated by C#, the MT_PP_014_PrdOrderGoodsRcv element isn't inlucded in the namespace http://mycompany.com/xi/sap/system/pp, which cause the error.
    Anyone know how to fix it?
    Thanks and B'Rgds,

    Hi YiNing,
    the message created by C# is indeed wrong.
    Check that in XMLSpy message, the default namespace is never set and that the message namespace is set to prefix "m" and that only the root tag is included in this namespace. All the other tags have no namespace (since they are not attached to any namespace prefix) or have the default namespace, which was not set.
    On the other hand, in the C# message, the default namespace is set in the root tag. The root tag is related to the default namespace (it has no prefix) and hence it has the proper namespace. However, the other tags are also related to the default namespace (no namespace prefix) which was set. So these other tags are the erroneous ones.
    Try to check that in your proxy, but it seems like a bug in the proxy generator application.
    Just as a test, send the message from C# in a request from XMLSpy (replace the automatically generated message inside SOAP Body). The same error would be expected.
    Also as a test, send this message in XMLSpy:
    <MT_PP_014_PrdOrderGoodsRcv xmlns="http://mycompany.com/xi/sap/system/pp">
    <content xmlns="">
    </content>
    </MT_PP_014_PrdOrderGoodsRcv>
    Regards,
    Henrique.

  • Outlook is unable to connect to the proxy server.(Error Code 10)

    Hi,
    I had problems with RPC proxy, I was trying to setup cutover migration.
    So I read somewhere that i need to change the certprincipalname with Set-Outlookprovider.
    But after this change my outlook was not working anymore
    The settings before the change were:
    Name                          Server                        CertPrincipalName             TTL
    EXCH                                                                        
                 1
    EXPR                                                                        
                 1
    WEB                                                                          
                1
    So I set this back to the original (above) but this didn't helped...
    Outlook 2013 and Exchange 2013
    There is a problem with the proxy server's security certificate. The name on the security certificate is invalid or does not match the name of the target site mail.abc-company.com.
    Outlook is unable to connect to the proxy server.(Error Code 10)

    Hi,
    Please make sure the mail.abc-company.com is included in your Exchange certificate which has been assigned with IIS service.
    If possible, please run the following command for double check:
    Get-ExchangeCertificate | FL
    For Autodiscover service, please run
    Test E-mail AutoConfiguration to check if the connection is successful in Log tab and confirm the other services URL can use proper namespace in Results tab for request access.
    If the Autodiscover service fails, please create a SRV record with mail.abc-company.com for Autodiscover service to have a try:
    http://support2.microsoft.com/kb/940881/en-us
    Regards,
    Winnie Liang
    TechNet Community Support

  • Problems with the Proxy Programme--Please help

    Hi All,
    I have written a simple proxy server in the form of a servlet. I changed the proxy config of my browser to connect to this servlet hosted on the default context(http://localhost:8080) of the Tomcat 5.0.25 . Well , this servlet internally connects to the proxy of the corporate LAN . The logic that I have applied is as follows. The servlet gets the request from the client (ie the browser in this case) , extracts the headers and contents from the request, sets them to a new request that it forms and finally send this new request to the proxy. When the proxy responds, the servlet collects the response headers and contents adn writes them in its response. To sum up , this servlet transparently carries the requests and responses between the client(browser) and the corporate LAN proxy. Now the problem is this. Let's say , now I am accessing http://www.google.com.The browser sends a request to my servlet with the following headers as they are extracted by my servlet.
    ProxyServer:::>posting request
    ProxyServer:::>headerValue::> headerName = accept : headerValue=*/*
    ProxyServer:::>headerValue::> headerName = referer : headerValue=http://www.google.com/
    ProxyServer:::>headerValue::> headerName = accept-language : headerValue=en-us
    ProxyServer:::>headerValue::> headerName = proxy-connection : headerValue=Keep-Alive
    ProxyServer:::>headerValue::> headerName = user-agent : headerValue=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; UB1.4_IE6.0_SP1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
    ProxyServer:::>headerValue::> headerName = host : headerValue=www.google.com
    ProxyServer:::>headerValue::> headerName = cookie : headerValue=PREF=ID=1be27c0a74f198ca:TM=1082058853:LM=1082058853:S=bu6ORrygzm8AUkm8
    ProxyServer:::>postRequest
    I set these headers into a new connection opened to the proxy and post a fresh request to the proxy,which, in turn responds with the following headers.
    ProxyServer:::>posted request successfully
    ProxyServer:::>writing response
    ProxyServer:::>writeResponse-->headerName = Proxy-Connection : headerValue = [close]
    ProxyServer:::>writeResponse-->headerName = Content-Length : headerValue = [257]
    ProxyServer:::>writeResponse-->headerName = Date : headerValue = [Tue, 13 Jul 2004 14:01:40 GMT]
    ProxyServer:::>writeResponse-->headerName = Content-Type : headerValue = [text/html]
    ProxyServer:::>writeResponse-->headerName = Server : headerValue = [NetCache appliance (NetApp/5.5R2)]
    ProxyServer:::>writeResponse-->headerName = Proxy-Authenticate : headerValue = [Basic realm="Charlotte - napxyclt2"]
    ProxyServer:::>writeResponse-->headerName = null : headerValue = [HTTP/1.1 407 Proxy Authentication Required]
    ProxyServer:::>writeResponse exiting
    ProxyServer:::>wrote response successfully
    I write these headers back to the client. According to what I was thinking, the client ie the browser would open a new dialog box asking for username/password owing to the presence of the "Proxy-Authenticate " header. But it does not happen that way. Rather the browser stops responsding and displays a blank page. Does anyone know why it happens this way? I am pasting the server prog below for everybody's reference.
    package server.proxy;
    //import all servlet related classes
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.io.*;
    import java.net.*;
    import server.resources.*;
    //My Proxy server --->Currently it is very simplea and relies on
    //other proxy servers of an already connected network.
    public class ProxyServer extends HttpServlet
    //stores the resource bundle
    private ServerResBundle resBundle = null;
    //checks for the mode of operation
    private boolean proxySet = false;
    private String proxy = null;
    //storing the original System out/err etc
    private PrintStream sysOutOrig = null;
    private PrintStream sysErrOrig = null;
    private InputStream sysInOrig = null;
    //initialise certain features that are required later
    public void init() throws ServletException
    try
    //initialise the resource bundle
    this.initResBundle();
    System.out.println("ProxyServer:::>res bundle init");
    //set the mode of operation
    this.setMode();
    System.out.println("ProxyServer:::>mode set");
    //set the system out and err --System.setOut etc
    this.setSystemOutErr();
    System.out.println("ProxyServer:::>in/out/err set");
    }//End try
    catch(Exception e)
    System.out.println("Exception in init..."+(e.getMessage()));
    throw new ServletException(e);
    }//Edn
    catch(Throwable e)
    System.out.println("Irrecoverable Error...");
    throw new ServletException(e);
    }//End
    }//End init
    //method to init the resource bundle;
    private void initResBundle()
    this.resBundle = ServerResBundle.getBundle();
    }//End
    //method to set the mode of the server--proxy or direct
    private void setMode()
    //read the target proxy property from the bundle and
    //if it is set,take that URL
    String temp = (String)(this.resBundle.getResource(ResKeys.PROXY_SERVER));
    if ( (temp != null) && (temp.length() > 0) )
    this.proxySet = true;
    this.proxy = temp;
    temp = null;
    }//End
    }//End
    //method to set the system out and err etc
    private void setSystemOutErr() throws Exception
    //keep a copy of the original system out and error
    this.sysOutOrig = System.out;
    this.sysErrOrig = System.err;
    try
    //read the options adn if they are set, take the values directly
    String newOutStr = (String)(this.resBundle.getResource(ResKeys.SYSTEM_OUT));
    String newErrStr = (String)(this.resBundle.getResource(ResKeys.SYSTEM_ERR));
    if ((newOutStr != null) && (newOutStr.length() > 0))
    System.setOut(new PrintStream(new FileOutputStream(new File(newOutStr),true),true));
    }//End if
    if ((newErrStr != null) && (newErrStr.length() > 0))
    System.setErr(new PrintStream(new FileOutputStream(new File(newErrStr),true),true));
    }//End if
    }//End
    catch(Exception e)
    //restore the stuff
    System.setOut(this.sysOutOrig);
    System.setErr(this.sysErrOrig);
    }//End
    }//End
    //this is where the proxy functionalities will be embedded
    public void service(HttpServletRequest req,HttpServletResponse resp)
    throws ServletException,java.io.IOException
    //conenction URL
    URL target = null;
    //conenction to the remote object
    URLConnection targetConn = null;
    //stores the OOS and the OIS
    ObjectOutputStream oos = null;
    ObjectInputStream ois = null;
    try
    //check for the mode of operation
    if (proxySet)
    URLConnection objects go through two phases: first they are created, then they are connected.
    After being created, and before being connected, various options can be specified
    (e.g., doInput and UseCaches). After connecting, it is an error to try to set them.
    Operations that depend on being connected, like getContentLength, will implicitly perform the connection,
    if necessary.
    //for the URL to the proxy
    target=new URL(this.proxy);
    //conenct to the proxy
    targetConn = target.openConnection();
    //set the details of the connectuon
    targetConn.setDoInput(true);
    targetConn.setDoOutput(true);
    targetConn.setUseCaches(false);
    // If true, this URL is being examined in a context in which it makes sense to allow user interactions such as popping up an authentication dialog. If false, then no user interaction is allowed
    targetConn.setAllowUserInteraction(true);
    //connect to the remote object
    // targetConn.connect();//call this only when all the request properties are set
    System.out.println("ProxyServer:::>posting request");
    //post the received request to the URL
    this.postRequest(targetConn,req);
    System.out.println("ProxyServer:::>posted request successfully");
    System.out.println("ProxyServer:::>writing response");
    //receive the response
    //write the received response to the client
    this.writeResponse(targetConn,resp);
    System.out.println("ProxyServer:::>wrote response successfully");
    }//End if
    else
    //currently this functionality is not supported
    throw new ServletException(
    (String)(this.resBundle.getResource(ResKeys.ERR_FUNC_NOTSUPPORTED)));
    }//End
    }//End try
    catch(Exception e)
    if(e instanceof ServletException)
    throw (ServletException)e;
    }//End
    if (e instanceof IOException)
    throw (IOException)e;
    }//End
    //wrap it up in ServletException
    throw new ServletException(e);
    }//End
    }//End
    //method to write the response back to the client
    private void writeResponse(URLConnection targetConn,HttpServletResponse resp)
    throws ServletException
    //get all the header fields from the response connection and set them to the
    //response of the servlet
    Map headerFields = null;
    Iterator headerFieldEntries = null;
    Map.Entry header = null;
    //stores the input stream to the conn
    BufferedReader brConn = null;
    //stores the writer to the response
    PrintWriter prResp = null;
    //checks if the proxy authentication needed or not
    boolean proxyAuthReqd = false;
    try
    //juste ensuring that the proxy authentication is reset
    proxyAuthReqd = false;
    if( (targetConn != null) && (resp != null) )
    //Returns an unmodifiable Map of the header fields.
    //The Map keys are Strings that represent the response-header field names.
    //Each Map value is an unmodifiable List of Strings that represents the corresponding
    //field values
    headerFields = targetConn.getHeaderFields();
    //Returns a set view of the mappings contained in this map
    Set temp = headerFields.entrySet();
    //Returns an iterator over the elements in this set
    headerFieldEntries = temp.iterator();
    if (headerFieldEntries != null)
    while (headerFieldEntries.hasNext())
    Object tempHeader = headerFieldEntries.next();
    if (tempHeader instanceof Map.Entry)
    header = (Map.Entry)tempHeader;
    Object headerName = header.getKey();
    Object headerValue=header.getValue();
    System.out.println("ProxyServer:::>writeResponse-->headerName = "+headerName+" : headerValue = "+headerValue);
    //do not select the key-value pair if both the key adn the value are null
    if ( ( headerName == null) && (headerValue == null) )
    continue;
    }//Enmd
    if (headerValue != null)
    List headerValList = null;
    if (headerValue instanceof List)
    headerValList = (List)headerValue;
    }//End
    if(headerValList != null)
    for (int i=0;i<headerValList.size();i++)
    Object headerValueStr = headerValList.get(i);
    if (headerValueStr instanceof String)
    //note that the header-key can not be null for addHeader
    //I have made this temporary provision to make the programme work.
    resp.addHeader(( (headerName==null)? ("null_header"+i) :(String)headerName),
    (String)headerValueStr);
    //check if the proxy authentication required or not
    if (((String)headerValueStr).
    indexOf(resp.SC_PROXY_AUTHENTICATION_REQUIRED+"") != -1)
    System.out.println("ProxyServer:::>writeResponse-->proxy auth needed");
    //proxy authentication is needed
    proxyAuthReqd = true;
    }//End
    }//Ednd of
    else if (headerValueStr == null)
    resp.addHeader(( (headerName==null)? null :(String)headerName),
    null);
    }//End
    }//End for
    }//End if
    }//End if
    }//End
    }//End while
    }//End if
    //get the writer to the client
    prResp = resp.getWriter();
    System.out.println("ProxyServer:::>writeResponse-->proxyAuthReqd="+proxyAuthReqd);
    //juste test a simple header
    System.out.println("Proxy-Authenticate = "+(resp.containsHeader("Proxy-Authenticate")));
    //if the proxy asks you for authentication,pass on the same to the client
    //from whom you have received the request.When this flag is true,the connection
    //is closed by the remotehost adn hence any attempt to open in input steram
    //results in an error ie IOException
    if (!proxyAuthReqd)
    //now get the content adn write it to the response too
    brConn = new BufferedReader(new InputStreamReader(
    targetConn.getInputStream()));
    String tempStr = null;
    while ((tempStr = brConn.readLine())!=null)
    prResp.println(tempStr);
    }//End while
    //close the connections
    brConn.close();
    }//End if
    else
    prResp.println("Proxy Authentication needed...");
    }//End
    //close the streams
    prResp.flush();
    prResp.close();
    }//End if
    System.out.println("ProxyServer:::>writeResponse exiting\n");
    }//End try
    catch(Exception e)
    throw new ServletException(e);
    }//End
    }//End
    //method to post request to the internet
    private void postRequest(URLConnection targetConn,HttpServletRequest req)
    throws ServletException
    //extract the header parameters and the body content from the incoming request
    //and set them to the new connection
    Enumeration reqHeaders = null;
    //reads the incoming request's content
    BufferedReader brReqRd = null;
    PrintWriter prResWt = null;
    //stores temp header names and values
    String headerName = null;
    String headerValue = null;
    try
    if( (targetConn != null) && (req != null) )
    reqHeaders = req.getHeaderNames();
    //extract a header adn set it to the new connection
    while (reqHeaders.hasMoreElements())
    headerName = (String)(reqHeaders.nextElement());
    headerValue = req.getHeader(headerName);
    targetConn.setRequestProperty(headerName,headerValue);
    System.out.println("ProxyServer:::>headerValue::> headerName = "+headerName+" : headerValue="+headerValue);
    }//End
    System.out.println("ProxyServer:::>postRequest\n");
    //establis the actual connection
    //calling this method bfore the above loop results in IllegalStateException
    targetConn.connect();
    //NOTE : try reading from and writing into OIS and OOS respectively
    //now read the contents and write them to the connection
    // brReqRd = req.getReader(); //this hangs for some reason
    brReqRd = new BufferedReader(new InputStreamReader(req.getInputStream()));
    System.out.println("Got the reader..brReqRd = "+brReqRd);
    if (brReqRd != null)
    String temp = null;
    //establish the printwriter
    // prResWt = new PrintWriter(targetConn.getOutputStream(),true);
    prResWt = new PrintWriter(targetConn.getOutputStream());
    System.out.println("trying to read in a loop from brReqRd.. ready="+(brReqRd.ready()));
    while( (brReqRd.ready()) && ((temp=brReqRd.readLine()) != null) )
    System.out.println("In while::>temp = "+temp);
    prResWt.println(temp);
    }//Emd while
    //close the streams adn go back
    brReqRd.close();
    prResWt.flush();
    prResWt.close();
    }//End
    }//End outer if
    System.out.println("ProxyServer:::>postRequest exiting\n");
    }//End try
    catch(Exception e)
    throw new ServletException(e);
    }//End
    }//End
    }//End

    Hi serlank ,
    Thanks for your reply. Well , I initially I thought of not pasting the code,as it was too long. But I could not help it,as I thought I must show in code what I exactly meant. That's why I followed a description of my problem with the code. You could probably have copied the code and pasted it in one of your favourite editors to take a look at it. Did you,by any chance, try to read it on the browser? And as regards reposting the same message, I can say that I did it as I felt the subject was not quite appropriate in the first posting and I was not sure as to how I could delete/alter the posting. I am not asking for a code-fix,but some suggestions from some one who might ever have come across such a thing.Anyway, lemme know if you have any idea on it. Thanks...

  • There is a problem with the security certificate of the proxy server. Error code 18 and 38.

    Hi All,
    After several hours and a short night of sleep I'm out of ideas and hopefully someone here can help me trying to solve this one. First of all the situation:
    Exchange 2013 on a remote location with a CA-certificate.
    Outlook 2010 and 2013 on different locations, locally installed and on RDS.
    When I open Outlook on my laptop all is fine, no errors, good sync, no problem. But when I open Outlook on our Remote Desktop Servers with Outlook 2013 I'm getting errors like "There is a problem with the security certificate of the proxy server. The
    name on the security certificate is invalid or does not match the name of the site. Outlook is unable to connect to this server. (Error code 18)". Opening Outlook 2010 the message is the same, but the error code now is 38.
    After this Outlook opens and is working, there's one more error though. After a while an security warning pops up with the message: "Information you exchange with this site cannot be viewed or changed by others. However, there is a problem with the
    site's security certificate. * The security certificate was issued by a company you have not chosen to trust. View the certificate to determine whether you want to trust the certifying authority. * The security certificate is valid. * The name on the security
    certificate is invalid or does not match the name of the site."
    Strangest thing is, it is the certificate of my RDS! It isn't my valid en officially bought certificate from my mailserver. What's going on? I'm out of options, what I've tried so far (in random order):
    - restarting mailserver and AD;
    - restarting switches;
    - restarting routers;
    - restarting RDS, AD and all other servers;
    - bypassed proxyserver for RDS;
    - created a new profile;
    - checked recently installed updates;
    - checked certificate on mailserver;
    - checked RDS on a different location, working fine.
    Nothing helped, what can I do next? Please advice.
    Regards.

    Found a thread that solves half my problem (https://social.technet.microsoft.com/Forums/office/en-US/70d18244-889a-4d95-ac3f-e234672a82b2/there-is-a-problem-with-the-proxy-servers-security-certificate-error-when-starting-outlook?forum=exchangesvrclients).
    The first message can be suppressed by adding this to the Exchange config:
    set-outlookprovider -Identity EXCH -CertprincipalName msstd:webmail.domain.tld
    set-outlookprovider -Identity EXPR -CertprincipalName msstd:webmail.domain.tld
    Giving the command get-outlookprovider, gives me empty information regarding the certprinipalname. Filled
    this and after recreating the profile or deleting the ost-file I still have the second alert with the local certificate of my RDS.
    Not completely where I want to be, any help regarding the second alert is greatly appreciated!

  • Is there a way to force the proxy.pac RELOAD before sending a UIWebView request?

    I'm working with a dynamic .pac remote file.
    When i start my app, i get the proxy automatic configuration only the first time...
    Is there a way to force the PAC reload every time I use a UIWebView ?

    sure, create a listener that waits for the complete event, then play the video.

  • Is it possible to remove the 'soap12' namespace from the WSDL for basicHttpBinding endpoints (i.e soap 1.1 clients)?

    Hello,
    We want to import the WSDL from a running WCF service endpoint (which is using basic HTTP binding) in order to implement the same web service interface in a Lotus Notes application. Unfortunately the proxy generator for Lotus Notes doesn't like the particular dialect of WSDL that our WCF service is exposing, in particular it throws a wobbly when it sees
    xmlns:soap12=http://schemas.xmlsoap.org/wsdl/soap12/.
    Even though soap1.2 isn't being used, the basic http binding is leaving this reference in the wsdl and Lotus Notes seems to think this is a SOAP 1.2 WSDL file even though I know it's a SOAP 1.1 compatible file.
    In order to get around this I'm using disco.exe to pull the wsdl files down locally, manually edit the files to remove this unused name space and then edit all the schema import locations to convert lines such as http://localhost:7780/MEX?xsd=xsd0 to lines such as file://\wsdl\MEX.xsd etc...
    Is there a simple setting somewhere that will remove that 'soap12' fragment from the wsdl? It's a bit of a pain because we are in a development phase and so the WSDL isn't completely stable at the moment and is changing frequently which requires this manual editing stage.
    Thanks
    Paul.

    The following method works correctly for me:
    public class Soap11WsdlExporter : WsdlExporter
        public override MetadataSet GetGeneratedMetadata()
            var metadataSet = base.GetGeneratedMetadata();
            foreach (var metadataSection in metadataSet.MetadataSections)
                var description = metadataSection.Metadata as System.Web.Services.Description.ServiceDescription;
                if (description != null)
                    var namespaces = description.Namespaces.ToArray();
                    var newNamespaces = new XmlSerializerNamespaces();
                    foreach (var ns in namespaces)
                        if (ns.Name.ToLower() != "soap12")
                            newNamespaces.Add(ns.Name, ns.Namespace);
                    description.Namespaces = newNamespaces;
            return metadataSet;
    public class MyServiceHostFactory : ServiceHostFactory
        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
            ServiceHost serviceHost = new ServiceHost(serviceType, baseAddresses);
            var useSoap11 = true;
            //We only removing SOAP12 namespace only if all the bindings use SOAP11.
            foreach(var endPoint in serviceHost.Description.Endpoints)
                useSoap11 &= endPoint.Binding.MessageVersion.Envelope == EnvelopeVersion.Soap11;
            if (useSoap11)
                var behavior = serviceHost.Description.Behaviors.Find<ServiceMetadataBehavior>();
                if (behavior != null)
                    behavior.MetadataExporter = new Soap11WsdlExporter();
            return serviceHost;
    Hope this helps
    Another Paradigm Shift
    http://shevaspace.blogspot.com

Maybe you are looking for

  • My iPod will no longer turn on after attempting to update my iTunes to the newest version.

    Pretty self-explanatory for the most part. I was attempting to update iTunes to the newest version because I have been putting it off forever. It's not currently the newest version..however when it was updating, my iPod went into recovery mode (the s

  • How to populate the ship-to-party in Sales Order at the header level

    Hi Config experts, I created Sales Order. I entered the Sold-to-party number, item and Qty and when I press ENTER, the ship-to-party field does not get populated with Business Parter number. I am expecting the same sold-to-party number to get populat

  • Communication to the disk drive failed

    i've experienced this problem after burning 3 dvds, it appeared on the fourth but the data was still burned on the cd. Now i am trying to burn some of my files on the cd and it appeared again, this time it didn't burn the file at all.what could be th

  • Tab control and Ring???

    have a tab control, where results will be displayed on tabs A,B,C in my vi. i have a ring; of options 1,2,3 when i change them i get various results. (A-C correspond to 1-3) is there a way when i select '2' on my ring, it will bring up tab B?? hope t

  • Fi_Tax_Chk_Pricing_Data error

    Hai all, While creating an Info record i am getting the following error. "Fi_Tax_Chk_Pricing_Data . error code 13,function builder Tax2. How to fix this error. Cheers