小编MSw*_*zey的帖子

SharePoint 2010 Web服务上的Java JBoss 401错误

在Eclipse IDE中测试时,我的代码成功运行.

我使用生成的Copy.wsdl通过Web服务连接到MS SharePoint 2010

当我在JBoss服务器上部署我的代码(运行Adobe LifeCycle)时,我的代码收到401错误.

错误:

Caused by: org.jboss.ws.WSException: Invalid HTTP server response [401] - Unauthorized
at org.jboss.ws.core.soap.SOAPMessageUnMarshallerHTTP.read(SOAPMessageUnMarshallerHTTP.java:75)
at org.jboss.remoting.transport.http.HTTPClientInvoker.readResponse(HTTPClientInvoker.java:608)
at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:402)
at org.jboss.remoting.transport.http.HTTPClientInvoker.makeInvocation(HTTPClientInvoker.java:253)
... 156 more
Run Code Online (Sandbox Code Playgroud)

现在,如果我故意通过IDE使用错误的登录,我会收到此错误:

com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 401: Unauthorized
Run Code Online (Sandbox Code Playgroud)

更新:

所以经过更多的研究后发现J2EE支持,缺乏,NTLM就是原因.我已经尝试了几种无法解决的解决方案.

码:

protected void initialize(String username, String password) throws Exception {
    System.out.println("initialize()...");
    java.net.CookieManager cm = new java.net.CookieManager();
    java.net.CookieHandler.setDefault(cm);
    Authenticator.setDefault(new SharepointAuthenticator(username, password));
}
Run Code Online (Sandbox Code Playgroud)

认证

public class SharepointAuthenticator extends Authenticator {

private String username = "";
private String password = "";

public …
Run Code Online (Sandbox Code Playgroud)

java jboss web-services sharepoint-2010 http-status-code-401

7
推荐指数
1
解决办法
844
查看次数

C++从文本文件,逐字逐句或char字符中读取单词

我一直在谷歌上搜索并阅读我的书并尝试写出代码来阅读文本文件并逐个处理它,所以我可以按字母顺序排列它们并记住多少个单词使用的地方和使用了很多单词.我似乎无法使我的GetNextWord()函数正常工作,这让我发疯.

我需要逐个读取单词,如果是大写,则将每个字母转换为小写.我知道如何做到这一点,并成功地做到了这一点.它只是按字符逐字逐句地将它放入一个阻碍我的字符串中.

这是我最近的尝试:任何帮助都会令人惊讶,或者链接到关于如何逐字读取输入文件的教程.(Word是字母字符az和'(不)以空格,逗号,句号,;,:等结尾....

void GetNextWord()
{
    string word = "";
    char c;

    while(inFile.get(c))
    {
        while( c > 64 && c < 123 || c == 39)
        {
            if((isupper(c)))
            {
                c = (tolower(c));
            }
            word = word + c;
        }
        outFile << word;
    }
}
Run Code Online (Sandbox Code Playgroud)

c++ file-io textinput

4
推荐指数
1
解决办法
4万
查看次数

C++为什么我的示例程序不会创建输出文件?

我正在编写一个小型/ beta测试程序,该程序将用于我更大的项目程序中.它向用户请求输入文件名(IE data.txt)并创建名为filename.out(IE data.out)的输出文件.我试过一个简单的outFile <<"text here"; 尝试一下,但它不会创建输出文件.我确定我在这里搞砸了一些简单的东西,但我无法弄清楚是什么.

#include <fstream>
#include <iostream>
#include <string>
using namespace std;

//Global variables 
ifstream inFile;
ofstream outFile;


void main()
{
// Requests user for input filename
string inputFile;           
cout << "Enter File Name: ";
cin >> inputFile;
string outputFile = inputFile.substr(0, inputFile.find_last_of('.')) + ".out";
// Opens both inputFile and outputFile
inFile.open(inputFile.c_str(), ios::in);
outFile.open(outputFile.c_str(), ios::in);
// Checks for input file
if (!inFile)
 {
      cout << "Unable to open file" << endl;
      exit(1);
 }

outFile << "Hello …
Run Code Online (Sandbox Code Playgroud)

c++ filestream

2
推荐指数
1
解决办法
2535
查看次数

C++冒泡排序双链表

我知道冒泡排序可能不是最快的方法,但它可以接受.我只是在调整算法以将数组中的链接列表加倍时遇到问题.

我的双链表有一个int类型和一个类型字符串来保存数字和一个单词.我的列表是按照我按字母顺序排序的插入排序排序的,现在我需要以数字方式重新排序我的双链表,最大到最小.

我的麻烦在于如何运行这个循环,以便彻底正确排序,而不仅仅是一次.

这是我到目前为止所做的事情:

void DblLinkedList::ReorderListNumeric()
{
dummy = new Node();
temphead = head;
temp = head->next;

while(tempTwo->next != NULL)
{
    if(temp->wordCount < tempTwo->wordCount)
    {               
        dummy->word = tempTwo->word;
        dummy->wordCount = tempTwo->wordCount;

        tempTwo->word = temp->word;
        tempTwo->wordCount = temp->wordCount;

        temp->word = dummy->word;
        temp->wordCount = dummy->wordCount;
    }
    temp = tempTwo;
    tempTwo = tempTwo->next;
}
}
Run Code Online (Sandbox Code Playgroud)

c++ double linked-list bubble-sort

2
推荐指数
1
解决办法
1万
查看次数